/**
  * 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 = \TYPO3\Flow\Http\Request::createFromEnvironment();
     $this->response = new \TYPO3\Flow\Http\Response();
     $this->boot();
     $this->resolveDependencies();
     $this->request->injectSettings($this->settings);
     $this->addDebugToolbarRoutes();
     $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);
     \Debug\Toolbar\Service\DataStorage::add('Request:Requests', $actionRequest);
     \Debug\Toolbar\Service\DataStorage::add('Request:Responses', $this->response);
     \Debug\Toolbar\Toolbar\View::handleRedirects($this->request, $this->response);
     $this->emitAboutToRenderDebugToolbar();
     \Debug\Toolbar\Service\DataStorage::set('Modules', \Debug\Toolbar\Service\Collector::getModules());
     if ($actionRequest->getFormat() === 'html') {
         echo \Debug\Toolbar\Toolbar\View::attachToolbar($this->response->getContent());
     } else {
         echo $this->response->getContent();
     }
     $this->bootstrap->shutdown('Runtime');
     $this->exit->__invoke();
     \Debug\Toolbar\Service\DataStorage::save();
 }
Example #2
0
 /**
  * TODO: Document this Method! ( handleRedirects )
  */
 public static function handleRedirects($request, $response)
 {
     $previousTokens = array();
     if ($request->hasArgument('__previousDebugToken')) {
         $previousTokens = explode(',', $request->getArgument('__previousDebugToken'));
         \Debug\Toolbar\Service\DataStorage::set('Request:RedirectedRequest', implode(',', $previousTokens));
     }
     if (intval($response->getStatus()) == 303) {
         $previousTokens[] = \Debug\Toolbar\Service\DataStorage::get('Environment:Token');
         $location = $response->getHeaders()->get('Location');
         $location .= stristr($location, '?') ? '&' : '?';
         $location .= '__previousDebugToken=' . implode(',', $previousTokens);
         $response->getHeaders()->set('Location', $location);
         $response->setContent('<html><head><meta http-equiv="refresh" content="0;url=' . $location . '"/></head></html>');
     }
 }
 /**
  * @param \TYPO3\Flow\Aop\JoinPointInterface $joinPoint
  * @Flow\Before("method(TYPO3\Flow\Http\RequestHandler->handleRequest())")
  * @return void
  */
 public function setStartTime(\TYPO3\Flow\Aop\JoinPointInterface $joinPoint)
 {
     \Debug\Toolbar\Service\DataStorage::set('Runtime:Start', microtime());
 }