コード例 #1
0
 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function restAction()
 {
     $this->restKernel->run();
     $result = ezpKernelRest::getResponse();
     if ($result === null) {
         throw new Exception('Rest Kernel run failed');
     }
     return new Response($result->getContent(), $result->hasAttribute('statusCode') ? $result->getAttribute('statusCode') : 200, $result->hasAttribute('headers') ? $result->getAttribute('headers') : array());
 }
コード例 #2
0
 /**
  * Action rendering the tree menu for admin interface.
  * Note that parameters are not used at all since the request is entirely forwarded to the legacy kernel.
  *
  * @param int $nodeId
  * @param int $modified
  * @param int $expiry
  * @param string $perm
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function viewMenu($nodeId, $modified, $expiry, $perm)
 {
     $response = new Response();
     if ($this->getParameter('treemenu.http_cache')) {
         $response->setMaxAge($this->getParameter('treemenu.ttl_cache'));
     }
     $result = $this->treeMenuKernel->run();
     if ($result->hasAttribute('lastModified')) {
         $response->setLastModified($result->getAttribute('lastModified'));
     }
     $response->setContent($result->getContent());
     return $response;
 }
コード例 #3
0
 /**
  * Action rendering the tree menu for admin interface.
  * Note that parameters are not used at all since the request is entirely forwarded to the legacy kernel.
  *
  * @param int $nodeId
  * @param int $modified
  * @param int $expiry
  * @param string $perm
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function viewMenu($nodeId, $modified, $expiry, $perm)
 {
     $response = new Response();
     if ($this->getParameter('treemenu.http_cache')) {
         $request = $this->getRequest();
         $response->setMaxAge($this->getParameter('treemenu.ttl_cache'));
         // Aggressive cache : Always return a 304 response if "If-Modified-Since" request header is present.
         if ($request->headers->has('If-Modified-Since')) {
             $response->setNotModified();
             return $response;
         }
     }
     $result = $this->treeMenuKernel->run();
     if ($result->hasAttribute('lastModified')) {
         $response->setLastModified($result->getAttribute('lastModified'));
     }
     $response->setContent($result->getContent());
     return $response;
 }
コード例 #4
0
 /**
  * Execution point for controller actions.
  * Returns false if not supported
  *
  * @return ezpKernelResult|false
  */
 public function run()
 {
     return $this->kernelHandler->run();
 }