/** * Resolve a route for the request * * Stores the resolved route values in the ComponentContext to pass them * to other components. They can be accessed via ComponentContext::getParameter('TYPO3\Flow\Mvc\Routing\RoutingComponent', 'matchResults'); * * @param ComponentContext $componentContext * @return void */ public function handle(ComponentContext $componentContext) { if ($componentContext->getParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization') !== TRUE) { $routesConfiguration = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES); $this->router->setRoutesConfiguration($routesConfiguration); } $matchResults = $this->router->route($componentContext->getHttpRequest()); $componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'matchResults', $matchResults); }
/** * @param ComponentContext $componentContext * @return void */ public function handle(ComponentContext $componentContext) { $routingMatchResults = $componentContext->getParameter(RoutingComponent::class, 'matchResults'); if ($routingMatchResults !== NULL) { return; } $httpRequest = $componentContext->getHttpRequest(); $this->redirectService->triggerRedirectIfApplicable($httpRequest); }
/** * Create an action request from stored route match values and dispatch to that * * @param ComponentContext $componentContext * @return void */ public function handle(ComponentContext $componentContext) { $httpRequest = $componentContext->getHttpRequest(); /** @var $actionRequest ActionRequest */ $actionRequest = $this->objectManager->get(ActionRequest::class, $httpRequest); $this->securityContext->setRequest($actionRequest); $routingMatchResults = $componentContext->getParameter(Routing\RoutingComponent::class, 'matchResults'); $actionRequest->setArguments($this->mergeArguments($httpRequest, $routingMatchResults)); $this->setDefaultControllerAndActionNameIfNoneSpecified($actionRequest); $componentContext->setParameter(self::class, 'actionRequest', $actionRequest); $this->dispatcher->dispatch($actionRequest, $componentContext->getHttpResponse()); }
/** * @test */ public function setParameterStoresTheGivenParameter() { $this->componentContext->setParameter('Some\\Component\\ClassName', 'someParameter', 'someParameterValue'); $this->assertSame('someParameterValue', $this->componentContext->getParameter('Some\\Component\\ClassName', 'someParameter')); }