/**
  * Set the routes configuration for the Neos setup and configures the routing component
  * to skip initialisation, which would overwrite the specific settings again.
  *
  * @param ComponentContext $componentContext
  * @return void
  */
 public function handle(ComponentContext $componentContext)
 {
     $configurationSource = $this->objectManager->get('TYPO3\\Flow\\Configuration\\Source\\YamlSource');
     $routesConfiguration = $configurationSource->load($this->packageManager->getPackage('TYPO3.Setup')->getConfigurationPath() . ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
     $this->router->setRoutesConfiguration($routesConfiguration);
     $componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization', TRUE);
 }
 /**
  * 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);
 }
 /**
  * @test
  * @expectedException \TYPO3\Flow\Mvc\Exception\InvalidRouteSetupException
  */
 public function createRoutesFromConfigurationThrowsExceptionIfOnlySomeRoutesWithTheSameUriPatternHaveHttpMethodConstraints()
 {
     $routesConfiguration = array(array('uriPattern' => 'somePattern'), array('uriPattern' => 'somePattern', 'httpMethods' => array('POST', 'PUT')));
     shuffle($routesConfiguration);
     $this->router->setRoutesConfiguration($routesConfiguration);
     $this->router->_call('createRoutesFromConfiguration');
 }
예제 #4
0
 /**
  * @return \TYPO3\Flow\Mvc\Routing\Router
  */
 protected function getRouter()
 {
     if ($this->router === NULL) {
         $this->router = $this->objectManager->get('\\TYPO3\\Flow\\Mvc\\Routing\\Router');
         $configurationManager = $this->objectManager->get('TYPO3\\Flow\\Configuration\\ConfigurationManager');
         $routesConfiguration = $configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
         $this->router->setRoutesConfiguration($routesConfiguration);
     }
     return $this->router;
 }
 /**
  * @param string $defaultPackageKey
  * @return StandaloneView
  */
 protected function createStandaloneView($defaultPackageKey = null)
 {
     // initialize router
     $this->router->setRoutesConfiguration($this->routesConfiguration);
     // initialize view
     $standaloneView = new StandaloneView();
     $actionRequest = $standaloneView->getRequest();
     // inject TYPO3.Flow settings to fetch base URI configuration & set default package key
     if (isset($this->flowSettings['http']['baseUri'])) {
         $actionRequest->getHttpRequest()->setBaseUri($this->flowSettings['http']['baseUri']);
     }
     $actionRequest->setControllerPackageKey($defaultPackageKey);
     return $standaloneView;
 }
예제 #6
0
 /**
  * Handles a HTTP request
  *
  * @return void
  */
 public function handleRequest()
 {
     // Create the request very early so the Resource Management has a chance to grab it:
     $this->request = Request::createFromEnvironment();
     $this->response = new Response();
     $this->boot();
     $this->resolveDependencies();
     $this->request->injectSettings($this->settings);
     $this->router->setRoutesConfiguration($this->routesConfiguration);
     $actionRequest = $this->router->route($this->request);
     $this->securityContext->setRequest($actionRequest);
     $this->dispatcher->dispatch($actionRequest, $this->response);
     $this->response->makeStandardsCompliant($this->request);
     $this->response->send();
     $this->bootstrap->shutdown('Runtime');
     $this->exit->__invoke();
 }
예제 #7
0
 /**
  * Initialize this engine
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->router->setRoutesConfiguration($this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_ROUTES));
 }