Process a server request and return a response.
8851
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $server = $request->getServerParams();
        $startTime = $server['REQUEST_TIME_FLOAT'] ?? microtime(true);
        $response = $handler->handle($request);

        return $response->withHeader(self::HEADER, sprintf('%2.3fms', (microtime(true) - $startTime) * 1000));
    }
600901
def process_request(self):
        """"""
        self.response = self.request_handler.process_request(
            self.method, self.request_data)
574136
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $isExecutingNextHandler = false;
        $next = new class($isExecutingNextHandler, $handler) implements RequestHandlerInterface {
            /**
             * @var bool
             */
            private $isExecutingNextHandler;
            /**
             * @var RequestHandlerInterface
             */
            private $nextHandler;

            public function __construct(bool &$isExecutingNextHandler, RequestHandlerInterface $realHandler)
            {
                $this->isExecutingNextHandler = &$isExecutingNextHandler;
                $this->nextHandler = $realHandler;
            }

            /**
             * Handle the request and return a response.
             */
            public function handle(ServerRequestInterface $request): ResponseInterface
            {
                $this->isExecutingNextHandler = true;
                $result = $this->nextHandler->handle($request);
                $this->isExecutingNextHandler = false;

                return $result;
            }
        };

        try {
            return $this->middleware->process($request, $next);
        } catch (\Throwable $throwable) {
            if ($isExecutingNextHandler) {
                throw $throwable;
            }

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

        return $response;
    }
1159471
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $response = $handler->handle($request);
        $code = $response->getStatusCode();
        $allowedCodes = array_keys($this->renderer) + array_keys($this->defaultErrors);
        if (in_array($code, $allowedCodes)) {
            if (!$response->getBody()->getSize()) {
                $format = FormatNegotiator::getPreferredFormat($request);

                if (isset($this->renderer[$code])) {
                    $content = $this->renderer[$code]($format);
                } else {
                    $content = $this->defaultRenderer($code, $format);
                }

                if (is_array($content)) {
                    $content = json_encode($content);
                }

                $body = $this->streamFactory->createStream($content);

                $response = $response->withBody($body);
                $response = $response->withStatus($code);

                if ($format === 'json') {
                    $response = $response->withHeader('content-type', 'application/json');
                } else {
                    $response = $response->withHeader('content-type', 'text/html; charset=utf-8');
                }
            }
        }

        return $response;
    }
421381
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if (file_exists(Webtrees::OFFLINE_FILE)) {
            $html = view('layouts/offline', [
                'message' => file_get_contents(Webtrees::OFFLINE_FILE),
                'url'     => (string) $request->getUri(),
            ]);

            return response($html, self::STATUS_SERVICE_UNAVAILABLE);
        }

        return $handler->handle($request);
    }
1139404
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $method = $this->getOverrideMethod($request);

        if (!empty($method) && $method !== $request->getMethod()) {
            $allowed = $this->getAllowedOverrideMethods($request);

            if (!empty($allowed)) {
                if (in_array($method, $allowed)) {
                    $request = $request->withMethod($method);
                } else {
                    return $this->createResponse(405);
                }
            }
        }

        return $handler->handle($request);
    }
712379
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        return $this->pipeline->withRequest($request, function () use ($request, $handler): ResponseInterface {
            return $handler->handle($request);
        });
    }
339721
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $uri = $request->getUri();
        $request = $request->withUri($uri->withPath($this->removeBasePath($uri->getPath())));

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

        if ($this->fixLocation && $response->hasHeader('Location')) {
            $location = parse_url($response->getHeaderLine('Location'));

            if (empty($location['host']) || $location['host'] === $uri->getHost()) {
                $location['path'] = $this->addBasePath($location['path']);

                return $response->withHeader('Location', self::unParseUrl($location));
            }
        }

        return $response;
    }
1083525
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $request = $request->withAttribute(self::ORIGINAL_REQUEST, $request);

        set_error_handler($this->createErrorHandler());

        try {
            $response = $handler->handle($request);
        } catch (Throwable $exception) {
            $response = $this->handleThrowable($exception, $request);
        }

        restore_error_handler();

        return $response;
    }
954693
function processResponse(err, res, body) {

    if (err) { return cb(err); }

    if (res.statusCode !== 200) {
      return cb(new ScrapeError('Not OK response from server.', res, body));
    }

    parseBody(body, model, options, cb);

  }
1318423
def _process_response(self, request, response):
        """"""
        log_format = self._get_log_format(request)
        if not log_format:
            return response

        params = self._get_parameters_from_request(request)
        # log a message displayed to user
        messages = django_messages.get_messages(request)
        result_message = None
        if messages:
            result_message = ', '.join('%s: %s' % (message.tags, message)
                                       for message in messages)
        elif 'action' in request.POST:
            result_message = request.POST['action']
        params['message'] = result_message
        params['http_status'] = response.status_code

        self.OPERATION_LOG.info(log_format, params)

        return response
901048
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        self::checkSessionCanStart();

        //Session name
        $name = $this->name ?: session_name();
        session_name($name);

        //Session id
        $id = $this->id;

        if (empty($id)) {
            $cookies = $request->getCookieParams();

            if (!empty($cookies[$name])) {
                $id = $cookies[$name];
            }
        }

        if (!empty($id)) {
            session_id($id);
        }

        if ($this->options === null) {
            session_start();
        } else {
            session_start($this->options);
        }

        // Session Id regeneration
        self::runIdRegeneration($this->regenerateIdInterval, $this->sessionIdExpiryKey);

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

        if ((session_status() === PHP_SESSION_ACTIVE) && (session_name() === $name)) {
            session_write_close();
        }

        return $response;
    }
1012298
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        try {
            try {
                return $handler->handle($request);
            } catch (HttpException $exception) {
                $original_exception = $exception;

                return $this->httpExceptionResponse($request, $exception);
            } catch (Throwable $exception) {
                $original_exception = $exception;

                return $this->unhandledExceptionResponse($request, $exception);
            }
        } catch (Throwable $exception) {
            // If we can't handle the exception, rethrow it.
            throw $original_exception;
        }
    }
1323030
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $uri = $request->getUri();
        $request = $request->withUri($uri->withPath($this->removeBasePath($uri->getPath())));

        $response = $handler->handle($request->withAttribute($this->attribute, $this->basePath));

        if ($this->fixLocation && $response->hasHeader('Location')) {
            $location = Factory::uri($response->getHeaderLine('Location'));

            $host = $location->getHost();
            if ($host === '' || $host === $uri->getHost()) {
                $location = $location->withPath($this->addBasePath($location->getPath()));

                return $response->withHeader('Location', (string) $location);
            }
        }

        return $response;
    }
651552
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        try {
            DB::connection()->beginTransaction();

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

            DB::connection()->commit();

            return $response;
        } catch (Throwable $exception) {
            DB::connection()->rollBack();

            throw $exception;
        }
    }
1146126
public function process(
        ServerRequestInterface $p_request,
        RequestHandlerInterface $p_handler
    ): ResponseInterface {
        // Get Content-Type and check if defined...
        $contentType = $p_request->getHeaderLine('Content-Type');
        $class       = false;
        if (array_key_exists($contentType, $this->formats)) {
            $class = $this->formats[$contentType]['class'];
        } else {
            foreach ($this->formats as $name => $format) {
                if ($format['default']) {
                    $class = $format['class'];
                }
            }
        }
        if ($class) {
            // Ok, encode, decode, ...
            $this->logger->debug(sprintf('FreeFW.Middleware.ApiNegociator %s', $class));
            $mid = \FreeFW\DI\DI::get($class);
            if ($mid instanceof \FreeFW\Interfaces\ApiAdapterInterface) {
                try {
                    if ($mid->checkRequest($p_request)) {
                        return $mid->encodeResponse(
                            $p_handler->handle(
                                $mid->decodeRequest($p_request)
                            )
                        );
                    } else {
                        if ($mid->canOverride()) {
                            return $p_handler->handle($p_request);
                        }
                    }
                } catch (\Exception $ex) {
                    return $mid->createErrorResponse($ex);
                }
                return $mid->createUnsupportedRequestResponse();
            } else {
                return $this->createResponse(500, []);
            }
        }
        // Not found
        return $this->createResponse(405, []);
    }