@param Request $request

@throws MissingRequestHandlerException

@return AbstractRequestHandler
428392
public function getSupportingHandler(Request $request): AbstractRequestHandler
    {
        foreach ($this->requestHandlers as $requestHandler) {
            if ($requestHandler->supportsApplication($request) && $requestHandler->supportsRequest($request)) {
                return $requestHandler;
            }
        }

        throw new MissingRequestHandlerException();
    }
875365
public function handle(Request $request)
    {
        try {
            $restRequest = new RestRequest($this->config, $request->getMethod(), $request->getUri(), $request->getContent());
            $restResponse = $this->adapter->processRequest($restRequest);
        } catch (\Exception $e) {
            if (true === $this->debugEnabled()) {
                throw $e;
            }
            $restResponse = $this->adapter->handleException($e);
        }
        return new Response($restResponse->getContent(), $restResponse->getStatus(), $restResponse->getHeaders());
    }
753110
public function getAction(Request $request)
    {
        $handlerFactory = $this->get('task.handler.factory');
        $entityClass = $this->getRequestParameter($request, 'entity-class', true);

        $handlers = [];
        foreach ($handlerFactory->getHandlers() as $handler) {
            if ($handler instanceof AutomationTaskHandlerInterface && $handler->supports($entityClass)) {
                $configuration = $handler->getConfiguration();
                $handlers[] = ['id' => get_class($handler), 'title' => $configuration->getTitle()];
            }
        }

        return new JsonResponse(['_embedded' => ['handlers' => $handlers]]);
    }
680998
public function resolveRequest(Request $request)
    {
        $format = $request->attributes->get(
            'format',
            $request->attributes->get('_format', 'html')
        );
        
        switch ($format) {
            case 'html':
            case 'page':
                return new DefaultHtmlRenderer();
                break;
            case 'api':
            case 'json':
                return new JsonApiRenderer();
                break;
            default:
                throw new InvalidConfigurationException(sprintf("Unsupported response format %s", $format));
        }
    }
72717
public function dispatch(Request $request)
    {
        /** @var DispatcherInterface $dispatcher */
        $dispatcher = $this->make(DispatcherInterface::class);

        return $dispatcher->dispatch($request);
    }
1286806
public function handle(Request $request) : Response
	{
		if ($result = $this->handleContext($request, $this->rootContext)) {
			return $result;
		}
		
		if ($defaultHandler = $this->rootContext->getDefault()) {
			return $this->resultToResponse(
				call_user_func($defaultHandler, $request, null)
			);
		}
		
		throw new Exception('No matching route found. Set a default handler on root context to cover this case.');
	}
867830
public function getRedirectFor(Request $request)
    {
        $redirects = $this->redirector->getRedirectsFor($request);

        collect($redirects)->each(function ($redirects, $missingUrl) {
            $this->router->get($missingUrl, function () use ($redirects, $missingUrl) {
                $redirectUrl = $this->determineRedirectUrl($redirects);
                $statusCode = $this->determineRedirectStatusCode($redirects);

                event(new RouteWasHit($redirectUrl, $missingUrl, $statusCode));

                return redirect()->to(
                    $redirectUrl,
                    $statusCode
                );
            });
        });

        try {
            return $this->router->dispatch($request);
        } catch (Exception $e) {
            event(new RedirectNotFound($request));

            return;
        }
    }
223650
protected function doRequest($request)
    {
        if (!$this->firstRequest) {
            $this->initialize($request);
        }
        $this->firstRequest = false;

        $this->applyBindings();
        $this->applyContextualBindings();
        $this->applyInstances();
        $this->applyApplicationHandlers();

        $request = Request::createFromBase($request);
        $response = $this->kernel->handle($request);

        $method = new \ReflectionMethod(get_class($this->app), 'callTerminableMiddleware');
        $method->setAccessible(true);
        $method->invoke($this->app, $response);

        return $response;
    }
846472
public function handle($request)
    {
        $this->loadAuthManager();
        
        try {
            $response = $this->sendRequestThroughRouter($request);
            $response = $response->getContent();
            
            $json = json_decode($response, true);
            if (json_last_error() == JSON_ERROR_NONE) {
                $response = $json;
            }
        } catch (Exception $e) {
            if ($e instanceof NotFoundHttpException) {
                $response = $e;
            } else {
                throw $e;
            }
        }
        
        $this->app['events']->fire('wskernel.handled', [$request, $response]);
        
        return $response;
    }
1007803
public function next(Request $request)
	{
		// Update the stack position
		$this->position++;

		// Get the next layer
		$layer = $this->layers[$this->position];

		// Call handle on next layer
		return $layer->handle($request);
	}
449989
public function handleRequest(Request $request): Promise {
        $method = $request->getMethod();
        $path = \rawurldecode($request->getUri()->getPath());

        $toMatch = "{$method}\0{$path}";

        if (null === $match = $this->cache->get($toMatch)) {
            $match = $this->routeDispatcher->dispatch($method, $path);
            $this->cache->put($toMatch, $match);
        }

        switch ($match[0]) {
            case Dispatcher::FOUND:
                /**
                 * @var RequestHandler $requestHandler
                 * @var string[] $routeArgs
                 */
                list(, $requestHandler, $routeArgs) = $match;
                $request->setAttribute(self::class, $routeArgs);

                return $requestHandler->handleRequest($request);

            case Dispatcher::NOT_FOUND:
                if ($this->fallback !== null) {
                    return $this->fallback->handleRequest($request);
                }

                return $this->makeNotFoundResponse($request);

            case Dispatcher::METHOD_NOT_ALLOWED:
                return $this->makeMethodNotAllowedResponse($match[1], $request);

            default:
                // @codeCoverageIgnoreStart
                throw new \UnexpectedValueException(
                    "Encountered unexpected dispatcher code: " . $match[0]
                );
                // @codeCoverageIgnoreEnd
        }
    }
576126
public function handleRequest(Request $request): void
    {
        $this->getForm()->handleRequest($request);
        $this->handleForm($request->get('page'));
    }
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);
    }
932611
public function cgetAction(Request $request)
    {
        try {
            // check if context exists and filters are enabled for the given context
            $context = $request->get('context');

            if (!$this->getManager()->hasContext($context)) {
                throw new UnknownContextException($context);
            }

            if (!$this->getManager()->isFeatureEnabled($context, 'filters')) {
                throw new MissingFeatureException($context, 'filters');
            }

            if ('true' == $request->get('flat')) {
                $list = $this->getListRepresentation($request);
            } else {
                $list = new CollectionRepresentation(
                    $this->getManager()->findFiltersForUserAndContext(
                        $context,
                        $this->getUser()->getId(),
                        $this->getRequestParameter($request, 'locale', true)
                    ),
                    self::$entityKey
                );
            }
            $view = $this->view($list, 200);
        } catch (UnknownContextException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingFeatureException $exc) {
            $exception = new RestException($exc->getMessage());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
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;
    }
1024166
function handleActionOrID($request)
    {
        if (is_numeric($request->param('Action'))) {
            $controller = $this->config()->recordController;
            return new $controller($this, $this->getRecordType(), $request);
        } else {
            return $this->handleAction($request, null);
        }
    }
1076542
protected function resolveRenderer(Request $request)
    {
        if ($request->hasArgument('renderer') && isset($this->renderer[$request->getArgument('renderer')])) {
            $rendererClassName = $this->renderer[$request->getArgument('renderer')];
            /** @var RenderingInterface $renderer */
            $renderer = new $rendererClassName();
            if ($renderer->canRender($request)) {
                return $renderer;
            }
        }

        foreach ($this->renderer as $rendererClassName) {
            /** @var RenderingInterface $renderer */
            $renderer = new $rendererClassName();
            if ($renderer->canRender($request)) {
                return $renderer;
            }
        }

        throw new Exception('No renderer found for this request!', 1403628294);
    }