Ejemplo n.º 1
0
 /**
  * Forwards the request to another action and / or controller.
  *
  * Request is directly transfered to the other action / controller
  * without the need for a new request.
  *
  * @param string $actionName Name of the action to forward to
  * @param string $controllerName Unqualified object name of the controller to forward to. If not specified, the current controller is used.
  * @param string $extensionName Name of the extension containing the controller to forward to. If not specified, the current extension is assumed.
  * @param array $arguments Arguments to pass to the target action
  * @return void
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException
  * @see redirect()
  * @api
  */
 public function forward($actionName, $controllerName = NULL, $extensionName = NULL, array $arguments = NULL)
 {
     $this->request->setDispatched(FALSE);
     $this->request->setControllerActionName($actionName);
     if ($controllerName !== NULL) {
         $this->request->setControllerName($controllerName);
     }
     if ($extensionName !== NULL) {
         $this->request->setControllerExtensionName($extensionName);
     }
     if ($arguments !== NULL) {
         $this->request->setArguments($arguments);
     }
     throw new \TYPO3\CMS\Extbase\Mvc\Exception\StopActionException();
 }
Ejemplo n.º 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 && $request instanceof WebRequest) {
         $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->controllerContext = $this->buildControllerContext();
     $this->view = $this->resolveView();
     if ($this->view !== NULL) {
         $this->initializeView($this->view);
     }
     $this->callActionMethod();
 }