예제 #1
0
 /**
  * Processes a generic request and fills the response with the default view
  *
  * @param \TYPO3\FLOW3\Mvc\RequestInterface $request The request object
  * @param \TYPO3\FLOW3\Mvc\ResponseInterface $response The response, modified by this handler
  * @return void
  * @api
  */
 public function processRequest(\TYPO3\FLOW3\Mvc\RequestInterface $request, \TYPO3\FLOW3\Mvc\ResponseInterface $response)
 {
     $this->initializeController($request, $response);
     $this->notFoundView->setControllerContext($this->controllerContext);
     if ($this->exception !== NULL) {
         $this->notFoundView->assign('errorMessage', $this->exception->getMessage());
     }
     switch (get_class($request)) {
         case 'TYPO3\\FLOW3\\Mvc\\ActionRequest':
             $response->setStatus(404);
             $response->setContent($this->notFoundView->render());
             break;
         default:
             $response->setContent("\nUnknown command\n\n");
     }
 }
예제 #2
0
 /**
  * Default action of this controller.
  *
  * @return void
  */
 public function indexAction()
 {
     if ($this->exception !== NULL) {
         $this->view->assign('errorMessage', $this->exception->getMessage());
     }
     $httpRequest = $this->request->getHttpRequest();
     $uriPath = $httpRequest->getUri()->getPath();
     $uriPathWithoutFormat = substr($uriPath, 0, strrpos($uriPath, '.'));
     preg_match(\TYPO3\TYPO3CR\Domain\Model\NodeInterface::MATCH_PATTERN_CONTEXTPATH, $uriPathWithoutFormat, $matches);
     if (isset($matches['WorkspaceName'])) {
         $uri = $httpRequest->getBaseUri() . '@' . $matches['WorkspaceName'];
     } elseif ($this->securityContext->getParty() instanceof \TYPO3\TYPO3\Domain\Model\User) {
         $uri = $httpRequest->getBaseUri() . '@' . $this->securityContext->getParty()->getPreferences()->get('context.workspace');
     } else {
         $uri = $httpRequest->getBaseUri();
     }
     $this->view->assign('pageTitle', '404 Not Found');
     $this->view->assign('errorTitle', 'Page Not Found');
     $this->view->assign('errorDescription', 'Sorry, we could not find any page at this URL.<br />Please visit the <a href="' . $uri . '">homepage</a> to get back on the path.');
     $this->response->setStatus(404);
 }