/** * Handle Web Request * * @param ServerRequestInterface $request * * @throws BaseException * @throws DependencyInjection\Exception\ServiceLockedException * @throws DependencyInjection\Exception\ServiceNotFoundException * @throws NotFoundException * @throws Response\Exception */ public function handleWeb(ServerRequestInterface $request) { $this->container->set('request', $request); /** @var Router $router */ $router = $this->container->get('router'); $router->handle(); $dispatcher = new Dispatcher(); $response = $dispatcher->setAction($router->getAction())->setActionNamespace($router->getActionNamespace())->setBundle($router->getBundle())->setParams($router->getParams())->setResponderNamespace($router->getResponderNamespace())->setRouteMatched($router->isMatched())->dispatch($request); if (!$response instanceof Response) { $response = new Response(); } $response->send(); }