Get a request handler from the container then proxy its ->handle()
method.

@param \Psr\Http\Message\ServerRequestInterface $request
@return \Psr\Http\Message\ResponseInterface
@throws \Ellipse\Handlers\Exceptions\ContainedRequestHandlerTypeException
163390
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $handler = $this->container->get($this->handler);

        if ($handler instanceof RequestHandlerInterface) {

            return $handler->handle($request);

        }

        throw new ContainedRequestHandlerTypeException($this->handler, $handler);
    }
879193
private function matchRequest(ServerRequestInterface $request): ?callable
    {
        try {
            $parameters = $this->matcher->match(
                $this->cleanSymfonyHandler($request->getUri()->getPath())
            );
        } catch (ResourceNotFoundException $e) {
            /* Do nothing, keep the framework to manage it */
        }

        if (empty($parameters['_controller'])) {
            return null;
        }

        if (\is_callable($parameters['_controller'])) {
            if (\is_string($parameters['_controller']) && false !== \strpos($parameters['_controller'], '::')) {
                return \explode('::', $parameters['_controller']);
            }

            return $parameters['_controller'];
        }

        if (!$this->container->has($parameters['_controller'])) {
            return null;
        }

        /**
         * @var callable
         */
        $entry = $this->container->get($parameters['_controller']);

        if (\is_callable($entry)) {
            return $entry;
        }

        return null;
    }
1252094
public function onRequest(ServerRequestInterface $request)
    {
        if ($this->isPopulateServer()) {
            $this->prepareEnvironment($request);
        }

        $remoteIp = $request->getHeaderLine('X-PHP-PM-Remote-IP');
        $remotePort = $request->getHeaderLine('X-PHP-PM-Remote-Port');

        $request = $request->withoutHeader('X-PHP-PM-Remote-IP');
        $request = $request->withoutHeader('X-PHP-PM-Remote-Port');

        $request = $request->withAttribute('remote_address', $remoteIp);
        $request = $request->withAttribute('remote_port', $remotePort);

        $logTime = date('d/M/Y:H:i:s O');

        $catchLog = function ($e) {
            console_log((string) $e);
            return new Response(500);
        };

        try {
            $response = $this->handleRequest($request);
        } catch (\Throwable $t) {
            $response = $catchLog($t);
        }

        $promise = new Promise(function ($resolve) use ($response) {
            return $resolve($response);
        });

        $promise = $promise->then(function (ResponseInterface $response) use ($request, $logTime, $remoteIp) {
            if ($this->isLogging()) {
                $this->logResponse($request, $response, $logTime, $remoteIp);
            }
            return $response;
        });

        return $promise;
    }
732102
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $stack = new Stack(
            $this->handlers,
            $this->handlerResolver
        );
        return $stack->handle($request);
    }
625495
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        $language = $request->getParsedBody()['language'];

        Session::put('language', $language);

        $this->user->setPreference('language', $language);

        return response('', self::STATUS_NO_CONTENT);
    }
788242
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // Bind the request into the container
        app()->instance(ServerRequestInterface::class, $request);

        // Load the route and routing table.
        $route  = $request->getQueryParams()['route'] ?? '';
        $routes = require 'routes/web.php';

        // Find the routing for the selected route.
        $routing = $routes[$request->getMethod() . ':' . $route] ?? '';

        // This timer gets stopped automatically when we generate the response.
        DebugBar::startMeasure('controller_action');

        // No route matched?
        if ($routing === '') {
            return $handler->handle($request);
        }

        // Routes defined using controller@action
        if (Str::contains($routing, '@')) {
            [$class, $method] = explode('@', $routing);

            $controller = app(self::CONTROLLER_NAMESPACE . $class);

            return app()->dispatch($controller, $method);
        }

        // Routes defined using a request handler
        return app($routing)->handle($request);
    }
342986
public function handle(ServerRequestInterface $request): ResponseInterface
    {
        if (!empty($this->default) && empty($this->middlewares[$this->offset])) {
            $handler = App::getBean($this->default);
        } else {
            $handler = $this->middlewares[$this->offset];
            \is_string($handler) && $handler = App::getBean($handler);
        }

        if (!$handler instanceof MiddlewareInterface) {
            throw new \InvalidArgumentException('Invalid Handler. It must be an instance of MiddlewareInterface');
        }

        return $handler->process($request, $this->next());
    }
319056
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
	{
		$requestMethod = $request->getMethod();
		$method = $this->getOverrideMethod($requestMethod, $request);

		if (!empty($method) && $method !== $requestMethod) {
			$allowed = $this->getAllowedOverrideMethods($requestMethod);
			if ([] !== $allowed) {
				if (\in_array($method, $allowed, true)) {
					$request = $request->withMethod($method);
				} else {
					return Factory::response(405);
				}
			}
		}

		return $handler->handle($request);
	}
1221026
public function handle(ServerRequestInterface $request): ResponseInterface{
        $routing        = $this->getRouteCollector()
            ->router($request->getUri()->getHost(), $request->getMethod())
            ->search($request->getUri()->getPath())
        ;
        $handlerBuilder = $kernel->getRequestHandlerBuilder();

        if($routing->found){
            $method = $routing->data["action"]["method"];
            $object = $kernel->getContainer()->getInstance(
                $routing->data["action"]["class"]
            );
            $action = [$object, $method];

            if($object instanceof Bundle\MiddlewareRegisterInterface){
                $object->middlewareRegister($handlerBuilder);
            }
        }else{
            $action = function(){
                throw new \Fratily\Http\Message\Status\NotFound();
            };
        }

        return $handlerBuilder
            ->append(
                new Controller\ActionMiddleware($this->getContainer())
            )
            ->create(
                $kernel->getContainer()->has("kernel.responseFactory")
                    ? $kernel->getContainer()->get("kernel.responseFactory")
                    : new \Fratily\Http\Message\ResponseFactory()
            )
            ->handle(
                $request
                    ->withAttribute("action", $action)
                    ->withAttribute("routing", $routing)
                    ->withAttribute("kernel", $kernel)
                    ->withAttribute(
                        "environment",
                        $kernel->getConfig()->getEnvironment()
                    )
                    ->withAttribute(
                        "debug",
                        $kernel->getConfig()->isDebug()
                    )
            )
        ;
    }
29793
public function handle(RequestInterface $request)
    {
        $handler = new RoutingHandler($this->container);

        if (! $this->has(Application::MIDDLEWARE))
        {
            return $handler->handle($request);
        }

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

        return $dispatcher->process($request, $handler);
    }
489361
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        $this->nextHandler = (isset($this->nextHandler)) ? next($this->handlers) : current($this->handlers);

        // nextHandler is a stack
        if ($this->nextHandler instanceof \Peak\Blueprint\Http\Stack) {
            return $this->returnResponse($this->handleStack($this->nextHandler, $request));
        }

        // no more handlers, look for parent
        if ($this->nextHandler === false && isset($this->parentStack)) {
            return $this->returnResponse($this->parentStack->process($request, $this->parentStack));
        } elseif ($this->nextHandler === false) {
            throw new StackEndedWithoutResponseException($this);
        }

        // resolve nextHandler if not already a object
        $handlerInstance = $this->nextHandler;
        if (is_callable($handlerInstance) || !is_object($handlerInstance)) {
            $handlerInstance = $this->handlerResolver->resolve($this->nextHandler);
        }

        // how to call the handler (MiddlewareInterface or RequestHandlerInterface)
        if ($handlerInstance instanceof MiddlewareInterface) {
            return $this->returnResponse($handlerInstance->process($request, $this));
        } elseif($handlerInstance instanceof RequestHandlerInterface) {
            return $this->returnResponse($handlerInstance->handle($request));
        }

        // at this point, the handler is not good
        throw new InvalidHandlerException($handlerInstance);
    }
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;
    }
612216
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        RendererFacade::init($this->renderer);
        return $handler->handle($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;
    }
1258478
public function processResourceRequestResponse(ResponseInterface $request)
    {
        $response = json_decode($request->getBody()->getContents());

        if (Response::HTTP_OK !== $request->getStatusCode() && Response::HTTP_CREATED !== $request->getStatusCode()) {
            return ExceptionHandler::handle(get_class($this), $response, $request->getStatusCode());
        }

        return (isset($response->data)) ? json_decode(json_encode($response->data), true) : json_decode(json_encode($response), true);
    }
1005090
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        if (class_exists(StandardDebugBar::class)) {
            DebugBar::enable();

            DebugBar::initPDO(DB::connection()->getPdo());

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

            if ($this->shouldSendDataOnNextPage($response)) {
                DebugBar::stackData();
            } elseif ($this->shouldSendDataInHeaders($request)) {
                DebugBar::sendDataInHeaders();
            }

            return $response;
        }

        return $handler->handle($request);
    }
687501
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
    {
        // Most requests will need the current tree and user.
        $ged  = $request->getQueryParams()['ged'] ?? $request->getParsedBody()['ged'] ?? '';
        $tree = Tree::findByName($ged);

        // No tree specified/available?  Choose one.
        if ($tree === null && $request->getMethod() === RequestMethodInterface::METHOD_GET) {
            $tree = Tree::findByName(Site::getPreference('DEFAULT_GEDCOM')) ?? array_values(Tree::getAll())[0] ?? null;
        }

        // Most layouts will require a tree for the page header/footer
        View::share('tree', $tree);

        // Need a closure, as the container does not allow you to bind null.
        app()->bind(Tree::class, static function () use ($tree): ?Tree {
            return $tree;
        });

        return $handler->handle($request);
    }