Dispatch the request, return a response.

@param ServerRequestInterface $request

@return ResponseInterface
342437
public function dispatch(ServerRequestInterface $request): ResponseInterface
    {
        return $this->get($request)->process($request, $this);
    }
727900
protected function dispatch(RequestInterface $request)
    {
        $route = $request->attribute(Application::ROUTE_ATTRIBUTE);

        if ($route instanceof RouteInterface)
        {
            return $route;
        }

        $dispatcher = $this->container->get(Application::DISPATCHER);

        $path = $request->uri()->path();

        return $dispatcher->dispatch($request->method(), $path);
    }
838615
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $result = $this->router->dispatch(
            $request->getMethod(),
            $request->getUri()->getPath()
        );

        return $handler->handle(
            $request->withAttribute('routing', $result)
        );
    }
1261062
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $module_name = $request->getQueryParams()['module'] ?? $request->getParsedBody()['module'] ?? '';
        $action      = $request->getQueryParams()['action'] ?? $request->getParsedBody()['action'] ?? '';

        // Check that the module is enabled.
        // The module itself will need to check any tree-level access,
        // which may be different for each component (tab, menu, etc.) of the module.
        $module = $this->module_service->findByName($module_name);

        if ($module === null) {
            throw new NotFoundHttpException('Module ' . $module_name . ' does not exist');
        }

        // We'll call a function such as Module::getFooBarAction()
        $verb   = strtolower($request->getMethod());
        $method = $verb . $action . 'Action';

        // Actions with "Admin" in the name are for administrators only.
        if (strpos($action, 'Admin') !== false && !Auth::isAdmin($this->user)) {
            throw new AccessDeniedHttpException('Admin only action');
        }

        if (!method_exists($module, $method)) {
            throw new NotFoundHttpException('Method ' . $method . '() not found in ' . $module_name);
        }

        return app()->dispatch($module, $method);
    }
205842
public function dispatch(ServerRequestInterface $request): ResponseInterface
    {
        reset($this->middleware);

        return $this->handle($request);
    }
195482
public function handleRequest(\Psr\Http\Message\ServerRequestInterface $request)
    {
        // We define this constant, so that any TYPO3-Extension can check, if the REST-API is running
        define('REST_API_IS_RUNNING', true);

        // Dispatch the API-call
        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
        $objectManager->get(Dispatcher::class)->dispatch();
    }
74158
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $route = $this->routerDispatcher->dispatch($request);
        if (count($route->getAttributes())) {
            foreach ($route->getAttributes() as $key => $value) {
               $request = $request->withAttribute($key, $value);
            }
        }
        $request = $request->withAttribute('route', $route);

        return $handler->handle($request);
    }
540567
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $allowLayers = $this->store->getLayersForRequest($request);
        $this->runner->setLayers($allowLayers);

        $this->emit(self::EVENT_BEFORE_HANDLE, [$request, $allowLayers]);
        $response = $this->runner->handle($request);
		$this->emit(self::EVENT_AFTER_HANDLE, [$request, $allowLayers, $response]);

		return $response;
    }
178066
public function dispatch(ServerRequestInterface $request)
    {
        parse_str($request->getUri()->getQuery(), $args);
        $uri = '/';
        if (isset($args['page'])) {
            $uri .= $args['page'];
        }

        return $this->createDispatcher()->dispatch(
            $request->getMethod(),
            $uri
        );
    }
353341
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (false === $this->booted) {
            $this->boot();
        }

        try {
            return $this->pipe->handle($request);
        } catch (Exception $e) {
            $this->getContainer()->get('logger')->error($e);
        }
    }
93745
public function respond(ServerRequest $request)
    {
        try
        {
            $response = $this->request($request)
                ->finalize()
                ->getResponse();
        }
        catch(\Exception $e)
        {
            if($failRoute = $this->failRoute)
            {
                $response = $this->execute($failRoute, array('exception' => $e, 'request' => $request), $request)
                    ->finalize()
                    ->getResponse();

                $this->failRoute = null;
            }
            else if($this->map->hasFailRoute())
            {
                $response = $this->execute($this->map->getFailRoute(), array('exception' => $e, 'request' => $request), $request)
                    ->finalize()
                    ->getResponse();
            }
            else
            {
                $message = '<pre><h2>['.get_class($e).'] '.$e->getMessage().'</h2>'.PHP_EOL;
                $message .= $e->getTraceAsString();

                $response = Response::createEmptyResponse()
                    ->setStatus(404)
                    ->setBody($message);
            }
        }

        return $response;
    }
373691
public function run(RequestInterface $request) : ResponseInterface
    {
        $stack = array_reverse($this->stack);
        $handler = $this->resolve($stack, 0);
        return $handler->handle($request);
    }
969183
public function handle(ServerRequestInterface $request): ResponseInterface{
        if($this->runningQueue === null){
            $this->runningQueue = clone $this->queue;
        }

        $this->runningLevel++;

        if($this->runningQueue->isEmpty()){
            $response   = $this->factory->createResponse();
        }else{
            $response   = $this->runningQueue->dequeue()->process($request, $this);
        }

        $this->runningLevel--;

        if($this->runningLevel === 0){
            $this->runningQueue = null;
        }

        return $response;
    }
719944
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (empty($this->requestHandler)) {
            $this->requestHandler = $this->requestHandler();
        }

        return $this->pipeline->process(
            $request->withAttribute(self::ROUTE_ATTRIBUTE, $this),
            $this->requestHandler
        );
    }
1202864
public function updateMenus(ServerRequestInterface $request): ResponseInterface
    {
        $modules = $this->module_service->findByInterface(ModuleMenuInterface::class, true);

        $this->updateStatus($modules, $request);
        $this->updateOrder($modules, 'menu_order', $request);
        $this->updateAccessLevel($modules, ModuleMenuInterface::class, $request);

        return redirect(route('menus'));
    }
939406
protected function generate404(ServerRequestInterface $request): ResponseInterface
    {
        if ($this->default404 !== null) {
            if (\is_callable($this->default404)) {
                return \call_user_func_array($this->default404, [$request, [$this, 'handle']]);
            } elseif ($this->default404 instanceof MiddlewareInterface) {
                return $this->default404->process($request, $this);
            } elseif (\is_string($this->default404)) {
                $default404Instance = (new $this->default404());
                if (\method_exists($default404Instance, 'process')) {
                    return $default404Instance->process($request, $this);
                }
            }

            throw new RouterException('The default404 is invalid');
        }
        throw new RouterException('No route found to dispatch');
    }
164276
public function dispatch(\Illuminate\Http\Request $request)
	{
		$this->currentRequest = $request;

		$response = $this->prepareResponse($request, $request);

		return $response;
	}