Process a server request and return a response.

@param ServerRequestInterface $request
@param DelegateInterface      $delegate

@return ResponseInterface
7627
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $uriPath = $request->getUri()->getPath();

        /** @var Description $description */
        foreach ($this->repository as $description) {

            $basePath = $description->getBasePath() ? "{$description->getBasePath()}/" : "";

            foreach ($description->getPaths() as $path) {
                $pathPattern = "$basePath{$path->getPath()}";

                $parameterNames = [];
                foreach ($path->getOperations() as $operation) {
                    foreach ($operation->getParameters() as $parameter) {
                        if ($parameter->getIn() === Parameter::IN_PATH
                            && ($schema = $parameter->getSchema()) instanceof ScalarSchema
                        ) {
                            $parameterName    = $parameter->getName();
                            $parameterNames[] = $parameterName;
                            $typePattern      = $this->typePatternResolver->resolve($schema);
                            $parameterPattern = "(?P<$parameterName>$typePattern)(?=(/|$))";
                            $pathPattern      = str_replace('{' . $parameterName . '}', $parameterPattern, $pathPattern);
                        }
                    }

                    if (preg_match("#^$pathPattern$#", $uriPath, $matches) > 0) {
                        if (strtolower($request->getMethod()) !== $operation->getMethod()) {
                            return Factory::createResponse(405);
                        }

                        $request = Meta::requestWith($request, $description, $operation, $path);

                        foreach ($parameterNames as $parameterName) {
                            $request = $request->withAttribute($parameterName, $matches[$parameterName]);
                        }

                        return $delegate->process($request);
                    }
                }

            }
        }

        return Factory::createResponse(404);
    }
832769
public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
    {
        $method = $request->getMethod();
        if (!\in_array($method, $this->ignoreHttpMethods, true) && $this->isSupportContentType($request)) {
            $parsedJson = $this->parse($request);
            $request = $request->withParsedBody($parsedJson);
        }

        return $next->handle($request);
    }
530849
public function handle(ServerRequestInterface $request, DelegateInterface $next)
    {
        $cookies = $request->getCookieParams();

        if (!isset($cookies[static::SESSION_ID_KEY])) {
            $sessionId = session_create_id();
        } else {
            $sessionId = $cookies[static::SESSION_ID_KEY];
        }

        $request->withHeader(static::SESSION_ID_KEY, $sessionId);

        $response = $next->process($request);

        return $response->withCookie(static::SESSION_ID_KEY, $sessionId);
    }
819828
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        if (null !== ($data = $request->getAttribute(CommandDispatcher::ATTRIBUTE))) {
            $operation = $this->getOperation($request);
            $schema    = $operation
                ->getResponse($this->okStatusResolver->resolve($data, $operation))
                ->getSchema();

            $request = $request->withAttribute(
                CommandDispatcher::ATTRIBUTE,
                $this->processorBuilder->build($schema)->dehydrate($data)
            );
        }

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

        $this->assertHeadersNotEmitted();
        $this->assertBodyNotEmitted();
        $this->emitStatusLine($response);
        $this->emitHeaders($response);
        $this->emitBody($response);
        $this->closeConnection();

        return $response;
    }
854680
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = (new ResponseFactory)->createResponse();

        $analyzer = CorsAnalyzer::instance($this->buildSettings($request, $response));
        if ($this->logger) {
            $analyzer->setLogger($this->logger);
        }
        $cors = $analyzer->analyze($request);

        switch ($cors->getRequestType()) {
            case CorsAnalysisResultInterface::ERR_ORIGIN_NOT_ALLOWED:
                $response = $response->withStatus(401);
                return $this->processError($request, $response, [
                    "message" => "CORS request origin is not allowed.",
                ]);
            case CorsAnalysisResultInterface::ERR_METHOD_NOT_SUPPORTED:
                $response = $response->withStatus(401);
                return $this->processError($request, $response, [
                    "message" => "CORS requested method is not supported.",
                ]);
            case CorsAnalysisResultInterface::ERR_HEADERS_NOT_SUPPORTED:
                $response = $response->withStatus(401);
                return $this->processError($request, $response, [
                    "message" => "CORS requested header is not allowed.",
                ]);
            case CorsAnalysisResultInterface::TYPE_PRE_FLIGHT_REQUEST:
                $cors_headers = $cors->getResponseHeaders();
                foreach ($cors_headers as $header => $value) {
                    /* Diactoros errors on integer values. */
                    if (false === is_array($value)) {
                        $value = (string)$value;
                    }
                    $response = $response->withHeader($header, $value);
                }
                return $response->withStatus(200);
            case CorsAnalysisResultInterface::TYPE_REQUEST_OUT_OF_CORS_SCOPE:
                return $handler->handle($request);
            default:
                /* Actual CORS request. */
                $response = $handler->handle($request);
                $cors_headers = $cors->getResponseHeaders();
                foreach ($cors_headers as $header => $value) {
                    /* Diactoros errors on integer values. */
                    if (false === is_array($value)) {
                        $value = (string)$value;
                    }
                    $response = $response->withHeader($header, $value);
                }
                return $response;
        }
    }
32281
public function process(Request $request, DelegateInterface $frame)
    {
        $route = $request->attributes->get('_route');
        $psrRequest = $this->psrFactory->createRequest($request);

        // Validate the request. This throws exceptions on failure
        $psrRequest = $this->oauth->validateAuthenticatedRequest($psrRequest);
        $newRequest = $this->foundationFactory->createRequest($psrRequest);

        // Merge in attributes to existing request object
        $request->attributes->add($newRequest->attributes->all());

        // Handle route scope
        if ($route) {
            if ($routeScopes = $route->getOption('oauth_scopes')) {
                $requestScopes = $request->attributes->get('oauth_scopes');

                if (!array_intersect((array)$routeScopes, (array)$requestScopes)) {
                    throw new OAuthServerException(
                        'Endpoint out of scope.', 1, 'invalid_request', 400, 'Try reauthorizing with the proper scope.'
                    );
                }
            }

            if ($userId = $request->attributes->get('oauth_user_id')) {
                /**
                 * @var $request \Concrete\Core\Http\Request
                 */
                $request->setCustomRequestUser(
                    $this->userRepository->getByID($userId)
                );
            }
        }

        return $frame->next($request);
    }
170255
public function execute(ServerRequestInterface $request, ResponseInterface $response) : ResponseInterface {
		$httpRequestResponse = new HTTPRequestResponseContainer($request, $response);

		$this->dispatchRequestFilters($httpRequestResponse);

		$this->dispatchResponseFilters($httpRequestResponse);

		return $httpRequestResponse->getResponse();
	}
298627
public function process(ServerRequestInterface $request, RequestHandlerInterface $next) : ResponseInterface
    {
        $server = $request->getServerParams();
        $startTime = $server['REQUEST_TIME_FLOAT'] ?? microtime(true);

        $response = $next->handle($request);
        $diff = $this->getDiff($startTime);

        return $response->withHeader(self::HEADER, sprintf('%2.3fms', $diff));
    }
215448
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $body = $request->getBody();

        if ($contents = $body->getContents()) {
            $body->rewind();
            $request = $request->withParsedBody($this->bodyParser->parse($contents));
        }

        return $delegate->process($request);
    }
706818
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = new \GuzzleHttp\Psr7\Response();
        $controller = $this->getController(
            new \phpGone\Router\Routeur(),
            $request
        );
        if (is_null($controller)) {
            return $handler->handle($request);
        }
        ob_start();
        $controller->execute();
        $responseController = ob_get_clean();
        $response->getBody()->write($responseController);
        return $response;
    }
8534
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
       if($this->detector->isMobile()){
           $request->withAttribute('client-isMobile', TRUE);
       }
       if($this->detector->isTablet()){
           $request->withAttribute('client-isTablet', TRUE);
       }
       if($this->detector->isiOS()){
           $request->withAttribute('client-isiOS', TRUE);
       }
       if($this->detector->isiAndroidOS()){
           $request->withAttribute('client-isAndroidOS', TRUE);
       }

        return($handler->handle($request));
        
    }
1169181
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $rootRequest = new RootRequest($request);
        return $handler->handle($rootRequest);
    }
995797
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $begin = microtime(true);
        $response = $handler->handle($request);
        $end = microtime(true);

        $message = $this->format;
        $message = $this->replaceConstantDirectives($message, $request, $response, $begin, $end);
        $message = $this->replaceVariableDirectives($message, $request, $response, $begin, $end);

        $context = [];

        if ($this->context !== null) {
            $contextFunction = $this->context;
            $context = $contextFunction($request, $response);
        }

        $statusCode = $response->getStatusCode();

        if ($statusCode >= 400 && $statusCode < 500) {
            $this->logger->warning($message, $context);
        } elseif ($statusCode >= 500 && $statusCode < 600) {
            $this->logger->error($message, $context);
        } else {
            $this->logger->info($message, $context);
        }

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

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

        if (stripos($response->getHeaderLine('Content-Type'), $this->mimetype) === 0) {
            $stream = $this->createStream($this->minify((string) $response->getBody()));

            return $response->withBody($stream)
                ->withoutHeader('Content-Length');
        }

        return $response;
    }
643691
public function process(ServerRequestInterface $request, DelegateInterface $delegate)
    {
        $result    = $request->getAttribute(CommandDispatcher::ATTRIBUTE);
        $operation = $this->getOperation($request);

        return Factory::createResponse($this->okStatusResolver->resolve($result, $operation))
            ->withBody($this->createStringStream($this->bodySerializer->serialize($result)))
            ->withHeader('Content-Type', $this->bodySerializer->getContentType());
    }