Process a request and return a response.

@param ServerRequestInterface $request
@param ResponseInterface      $response

@return ResponseInterface
170255
public function execute(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface {
		$httpRequestResponse = new HTTPRequestResponseContainer($request, $response);

		$this->dispatchRequestFilters($httpRequestResponse);

		$this->dispatchResponseFilters($httpRequestResponse);

		return $httpRequestResponse->getResponse();
	}
904370
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $requestPath = $this->getNormalizedPath($request);

        foreach ($this->middlewares as $pathPrefix => $middleware) {
            if (strpos($requestPath, $pathPrefix) === 0) {
                return $handler->handle(
                    $this->unprefixedRequest($request, $pathPrefix)
                        ->withAttribute($this->attribute, $middleware)
                );
            }
        }

        if ($this->continueOnError) {
            return $handler->handle($request);
        }

        return $this->responseFactory->createResponse(404);
    }
1268487
public function process(
        ServerRequestInterface $p_request,
        RequestHandlerInterface $p_handler
    ): ResponseInterface {
        return call_user_func_array([$this->object, $this->function], [$p_request]);
    }
228164
public function handle(
        ServerRequestInterface $request, ResponseInterface $response
    )
    {
        $key = ControllerInterface::REQUEST_ATTR_VIEW_DATA;
        $vars = $request->getAttribute($key, []);
        $session = Application::container()->get('session');
        $vars['flashMessages'] = new FlashMessages();
        $request = $request
            ->withAttribute('session', $session)
            ->withAttribute($key, $vars)
        ;

        return $this->executeNext($request, $response);
    }
1319594
protected function returnResponse(ResponseInterface $response): ResponseInterface
    {
        $this->nextHandler = null;
        reset($this->handlers);
        return $response;
    }
20440
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $errorPageConfig = Config::getInstance()->get('errorPage');
        $controllerClass = '\\app\\Controllers\\' . $errorPageConfig[0];
        $route = new Route('404', $errorPageConfig[0], $errorPageConfig[1]);
        $controller = new $controllerClass($route, $request);
        $response = new Response;
        ob_start();
        $controller->execute();
        $responseController = ob_get_clean();
        $response->getBody()->write($responseController);
        $response = $response->withStatus(404);
        $logger = new Logger();
        $logger->info('Error 404, NotFoundMiddleware');
        return $response;
    }
897487
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $this->withDecryptedCookies($request);
        $response = $handler->handle($request);

        return $this->withEncryptedCookies($response);
    }
338544
public function handle(
        ServerRequestInterface $request, ResponseInterface $response
    )
    {
        $path = array_key_exists(self::QUERY_PARAM, $request->getQueryParams())
            ? $request->getQueryParams()[self::QUERY_PARAM]
            : '';
        $uri = Uri::create($request->getUri());
        $queryString = ltrim(
            str_replace(
                self::QUERY_PARAM."={$path}",
                '',
                $uri->getQuery()
            ),
            '&'
        );
        $uri = $uri->withPath(str_replace('//', '/', "/$path"))
            ->withQuery($queryString);
        /** @var ServerRequestInterface $request */
        $request = $request->withUri($uri);
        return $this->executeNext($request, $response);
    }
575897
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if ($request->hasHeader('Accept-Encoding')) {
            $accept = $request->getHeaderLine('Accept-Encoding');

            $encoding = $this->getBest($accept, $this->encodings);

            if ($encoding === null) {
                return $handler->handle($request->withoutHeader('Accept-Encoding'));
            }

            return $handler->handle($request->withHeader('Accept-Encoding', $encoding));
        }

        return $handler->handle($request);
    }
42705
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
    {
        $response = $next->handle($request);

        if (\count($this->originHosts)) {
            $response = $response->withHeader(self::ORIGIN, implode(' ', $this->originHosts));
        }

        if (\count($this->allowHeaders)) {
            $response = $response->withHeader(self::HEADERS, implode(', ', $this->allowHeaders));
        }

        if (\count($this->allowMethods)) {
            $response = $response->withHeader(self::METHODS, implode(', ', $this->allowMethods));
        }

        return $response;
    }
752675
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        //Session name
        if ($this->name) {
            $name = $this->name;
            $this->session->setName($name);
        } else {
            $name = $this->session->getName();
        }

        $this->session->start($this->options);

        $response = $handler->handle($request);

        if ($this->session->isStarted() && ($this->session->getName() === $name)) {
            $this->session->commit();
        }

        return $response;
    }
1247273
public function handleResponse(ServerRequestInterface $request, ResponseInterface $response)
    {
        $applicationEvent = $this->getApplicationEvent();
        $applicationEvent->setName(self::EVENT_RESPONSE_CREATED);
        $applicationEvent->setResponse($this->getRouter()->dispatch(
            $request,
            $response
        ));

        $this->emit($applicationEvent, $request, $response);

        return $applicationEvent->getResponse();
    }
970227
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $this->checkAttributes($request, $this->attributes);

        return $handler->handle($request);
    }
838116
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $uuid = UuidFactory::uuid4()->toString();

        return $handler->handle($request->withHeader($this->header, $uuid))
            ->withHeader($this->header, $uuid);
    }
87531
public function process(ServerRequestInterface $request,  RequestHandlerInterface $handler) : ResponseInterface
    {
        $body = $this->parseBody($request);
        $parsedBody = $request->getParsedBody();

        $request = $request->withParsedBody(array_merge($body, $parsedBody));

        return $handler->handle($request);
    }
1108111
protected function errorResponse(ServerRequestInterface $request, ResponseInterface $response)
    {
        if (
            interface_exists(GlobalEnvironmentInterface::class, false) &&
            $response instanceof GlobalEnvironmentInterface &&
            $response->isStale()
        ) {
            $response = $response->revive();
        }

        $errorResponse = $response->withProtocolVersion($request->getProtocolVersion())->withStatus(500);
        $errorResponse->getBody()->write('An unexpected error occured');

        return $errorResponse;
    }
517429
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->execute([$request, $handler]);
    }