コード例 #1
0
 /**
  * Sends the specified HTTP status immediately.
  *
  * NOTE: This method only supports web requests and will thrown an exception if used with other request types.
  *
  * @param int $statusCode The HTTP status code
  * @param string $statusMessage A custom HTTP status message
  * @param string $content Body content which further explains the status
  * @throws UnsupportedRequestTypeException If the request is not a web request
  * @throws StopActionException
  * @api
  */
 public function throwStatus($statusCode, $statusMessage = null, $content = null)
 {
     if (!$this->request instanceof WebRequest) {
         throw new UnsupportedRequestTypeException('throwStatus() only supports web requests.', 1220539739);
     }
     if ($this->response instanceof \TYPO3\CMS\Extbase\Mvc\Web\Response) {
         $this->response->setStatus($statusCode, $statusMessage);
         if ($content === null) {
             $content = $this->response->getStatus();
         }
     }
     $this->response->setContent($content);
     throw new StopActionException('throwStatus', 1476045871);
 }
コード例 #2
0
 /**
  * Handles a request. The result output is returned by altering the given response.
  *
  * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object
  * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler
  *
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
  * @return void
  */
 public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 {
     if (!$this->canProcessRequest($request)) {
         throw new \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes), 1187701131);
     }
     if ($response instanceof \TYPO3\CMS\Extbase\Mvc\Web\Response) {
         $response->setRequest($request);
     }
     $this->request = $request;
     $this->request->setDispatched(TRUE);
     $this->response = $response;
     $this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $this->uriBuilder->setRequest($request);
     $this->actionMethodName = $this->resolveActionMethodName();
     $this->initializeActionMethodArguments();
     $this->initializeActionMethodValidators();
     $this->mvcPropertyMappingConfigurationService->initializePropertyMappingConfigurationFromRequest($request, $this->arguments);
     $this->initializeAction();
     $actionInitializationMethodName = 'initialize' . ucfirst($this->actionMethodName);
     if (method_exists($this, $actionInitializationMethodName)) {
         call_user_func(array($this, $actionInitializationMethodName));
     }
     $this->mapRequestArgumentsToControllerArguments();
     $this->checkRequestHash();
     $this->controllerContext = $this->buildControllerContext();
     $this->view = $this->resolveView();
     if ($this->view !== NULL) {
         $this->initializeView($this->view);
     }
     $this->callActionMethod();
 }
コード例 #3
0
 /**
  * Processes a general request. The result can be returned by altering the given response.
  *
  * @param \TYPO3\CMS\Extbase\Mvc\RequestInterface $request The request object
  * @param \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response The response, modified by this handler
  * @return void
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException if the controller doesn't support the current request type
  * @api
  */
 public function processRequest(\TYPO3\CMS\Extbase\Mvc\RequestInterface $request, \TYPO3\CMS\Extbase\Mvc\ResponseInterface $response)
 {
     if (!$this->canProcessRequest($request)) {
         throw new \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException(get_class($this) . ' does not support requests of type "' . get_class($request) . '". Supported types are: ' . implode(' ', $this->supportedRequestTypes), 1187701132);
     }
     $response->setRequest($request);
     $this->request = $request;
     $this->request->setDispatched(TRUE);
     $this->response = $response;
     $this->uriBuilder = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Mvc\\Web\\Routing\\UriBuilder');
     $this->uriBuilder->setRequest($request);
     $this->initializeControllerArgumentsBaseValidators();
     $this->mapRequestArgumentsToControllerArguments();
     $this->controllerContext = $this->buildControllerContext();
 }