original_string: public function beforeRender(Event $event)
      {
          /** @var \Cake\Controller\Controller $controller */
          $controller = $event->getSubject();
          $response = $controller->getResponse();
          $request = $controller->getRequest();
  
          if ($this->ext && !in_array($this->ext, ['html', 'htm'])) {
              if (!$response->getMimeType($this->ext)) {
                  throw new NotFoundException('Invoked extension not recognized/configured: ' . $this->ext);
              }
  
              $this->renderAs($controller, $this->ext);
              $response = $controller->response;
          } else {
              $response = $response->withCharset(Configure::read('App.encoding'));
          }
  
          if ($this->_config['checkHttpCache'] &&
              $response->checkNotModified($request)
          ) {
              $controller->setResponse($response);
  
              return false;
          }
          $controller->setResponse($response);
      }
code: public function beforeRender(Event $event)
      {
          /** @var \Cake\Controller\Controller $controller */
          $controller = $event->getSubject();
          $response = $controller->getResponse();
          $request = $controller->getRequest();
  
          if ($this->ext && !in_array($this->ext, ['html', 'htm'])) {
              if (!$response->getMimeType($this->ext)) {
                  throw new NotFoundException('Invoked extension not recognized/configured: ' . $this->ext);
              }
  
              $this->renderAs($controller, $this->ext);
              $response = $controller->response;
          } else {
              $response = $response->withCharset(Configure::read('App.encoding'));
          }
  
          if ($this->_config['checkHttpCache'] &&
              $response->checkNotModified($request)
          ) {
              $controller->setResponse($response);
  
              return false;
          }
          $controller->setResponse($response);
      }
code_tokens: public function beforeRender ( Event $ event ) { /** @var \Cake\Controller\Controller $controller */ $ controller = $ event -> getSubject ( ) ; $ response = $ controller -> getResponse ( ) ; $ request = $ controller -> getRequest ( ) ; if ( $ this -> ext && ! in_array ( $ this -> ext , [ 'html' , 'htm' ] ) ) { if ( ! $ response -> getMimeType ( $ this -> ext ) ) { throw new NotFoundException ( 'Invoked extension not recognized/configured: ' . $ this -> ext ) ; } $ this -> renderAs ( $ controller , $ this -> ext ) ; $ response = $ controller -> response ; } else { $ response = $ response -> withCharset ( Configure :: read ( 'App.encoding' ) ) ; } if ( $ this -> _config [ 'checkHttpCache' ] && $ response -> checkNotModified ( $ request ) ) { $ controller -> setResponse ( $ response ) ; return false ; } $ controller -> setResponse ( $ response ) ; }
docstring: Checks if the response can be considered different according to the request
  headers, and the caching response headers. If it was not modified, then the
  render process is skipped. And the client will get a blank response with a
  "304 Not Modified" header.
  
  - If Router::extensions() is enabled, the layout and template type are
  switched based on the parsed extension or `Accept` header. For example,
  if `controller/action.xml` is requested, the view path becomes
  `app/View/Controller/xml/action.ctp`. Also if `controller/action` is
  requested with `Accept: application/xml` in the headers the view
  path will become `app/View/Controller/xml/action.ctp`. Layout and template
  types will only switch to mime-types recognized by Cake\Http\Response.
  If you need to declare additional mime-types, you can do so using
  Cake\Http\Response::type() in your controller's beforeFilter() method.
  - If a helper with the same name as the extension exists, it is added to
  the controller.
  - If the extension is of a type that RequestHandler understands, it will
  set that Content-type in the response header.
  
  @param \Cake\Event\Event $event The Controller.beforeRender event.
  @return bool false if the render process should be aborted
  @throws \Cake\Http\Exception\NotFoundException If invoked extension is not configured.
docstring_tokens: Checks if the response can be considered different according to the request headers and the caching response headers . If it was not modified then the render process is skipped . And the client will get a blank response with a 304 Not Modified header .