Resolve the request and return a response.

@param \FluxBB\Server\Request $request
@return \FluxBB\Server\Response
@throws \FluxBB\Server\Exception\Exception
962081
public function dispatch(Request $request)
    {
        // Create the action instance
        $action = $this->resolveAction($request->getHandler());

        return $action->execute($request->getParameters());
    }
136566
public function handle($request)
    {
        $entity = $this->repository()->findById($request->getId());

        $this->authorize($request, $entity);
        $this->hydrateEntity($entity, $request->getData());
        $this->validateEntity($entity);
        $this->repository()->getEntityManager()->flush();

        return $this->response()->resource($request,
            new Item($entity, $this->transformer())
        );
    }
447760
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var $payment PaymentInterface */
        $payment = $request->getModel();

        $this->gateway->execute(new Sync($payment));

        $status = new GetStatus($payment);
        $this->gateway->execute($status);

        $nextState = $status->getValue();

        $this->updatePaymentState($payment, $nextState);
    }
883881
public function handle(Request $request)
    {
        if (!$this->booted) {
            $this->bootstrap();
        }

        $this->request = $request;
        $response = new Response();
        return($response);
    }
706959
public function handle(Request $request)
    {
        try {
            // 注册 Request
            $this->app::register('request', $request);

            // 启用 App
            $this->app->bootstrap();

            // 加载 Router
            $router = new Router();
            require $this->app->basePath.'/bootstrap/routes.php';

            // 注册 Router
            $this->app::register('router', $router);

            // 任务分发
            $response = $router->dispatch($request);
        }
        catch (Exception $e) {
            $this->app::make('log')->error('runtime exception: '. $e->getMessage(), [
                'code' => $e->getCode(),
                'file' => $e->getFile(),
                'line' => $e->getLine(),
            ]);

            if ($this->app->configGet('app.debug')) {
                throw new Exception('Http Request handle error', $e->getCode(), $e);
            }

            $response = new Response('', is_subclass_of($e, 'awheel\Exceptions\HttpException') ? $e->getStatusCode() : $e->getCode());
        }

        return $response;
    }
1145697
public function send(Request $request): Response
    {
        $this->serialInterface->send($request->encode());
        return $this->receiveResponse($request->getTimeout());
    }
845515
public function send(Request $request)
    {
        $rpbGetReq  = $this->createRpbMessage($request);
        $rpbGetResp = $this->client->send($rpbGetReq, RiakMessageCodes::GET_BUCKET_REQ, RiakMessageCodes::GET_BUCKET_RESP);
        $rpbProps   = $rpbGetResp->getProps();
        $response   = $this->createGetResponse($rpbProps);

        $response->name = $request->bucket;

        return $this->createGetResponse($rpbProps);
    }
14609
public function execute($request)
    {
        $result = $request->authHeaders()->send();

        if ($result->status === self::API_STATUS_FAIL) {
            throw new Exception('Error: '.$result->error);
        }

        return $result;
    }
1343644
public function send(Request $request) {
        $method   = strtolower($request->getMethod());
        $response = $method === HttpMethods::GET || $method === HttpMethods::DELETE ? $this->restClient->$method($request->getUrlAndQuery(), $request->getCurlOptions()) : $this->restClient->$method($request->getUrlAndQuery(), $request->getPayload(), $request->getCurlOptions());

        try {
            return $request->isExpectedStatusCode($response->getStatusCode()) ? $response : Exceptions::RequestFailedException($request, $response->getStatusCode(), $response->getContent());
        } catch (DBALException\DriverException $e) {
            $responseExceptionFactory = new ResponseExceptionFactory();
            throw $responseExceptionFactory->createDbalException($response, $e);
        }
    }
424130
public function handleRequest($request)
    {
        list ($route, $params) = $request->resolve();
        $this->requestedRoute = $route;
        $result = $this->runAction($route, $params);
        if ($result instanceof Response) {
            return $result;
        } else {
            $response = $this->getResponse();
            $response->exitStatus = $result;

            return $response;
        }
    }
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));
        }
    }
1003931
public function send(Request $request)
    {
        foreach ($this->cookies as $cookie) {
            $request->addCookie($cookie);
        }

        $response = $this->client->request($request);

        if ($response->getCookies()) {
            $this->cookies = $response->getCookies();
        }

        return $response;
    }
439934
protected function sendRequest(Request $request): Response
    {
        // Set password authentication for request.
        if ($this->password !== null) {
            $request->authenticate($this->password);
        }

        $this->send((string) $request);
        $response = new Response($this->get());
        return $response;

    }
633574
public function handle($request) : ResponseInterface
    {
        $this->setRouter($request);

        try {
            $response = $this->sendRequestThroughRouter($request);
            /*
             * Check whether return value is a instance of Response,
             * otherwise we will try to fetch the response form container,
             * create a response and return to the browser.
             *
             */
            if (!$response instanceof ResponseInterface && !is_array($response)) {
                $r = $this->container->has('response') ? $this->container->get('response') : '';
                $response = Response::make($r);
            }
        } catch (\Exception $e) {
            $this->handleException($e);
        } catch (Throwable $e) {
            $this->handleException($e);
        }

        return $response;
    }
879104
public function requestApiKeyAction(Request $request)
    {
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        $credentials = [];
        if ($request->request->has('login')) {
            $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login');
        }
        if ($request->request->has('password')) {
            $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password');
        }
        [$user, $exception] = $this->processAuthentication($credentials);

        /** @var OnAssembleResponseEvent $result */
        $result = $dispatcher->dispatch(
            Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE,
            new OnAssembleResponseEvent($user, $exception)
        );

        if (!$response = $result->getResponse()) {
            throw new HttpException(
                Response::HTTP_INTERNAL_SERVER_ERROR,
                'Cannot assemble the response!',
                $exception
            );
        }

        return $response;
    }
430583
public function handle($request)
    {
        $entity = $this->repository()->findById($request->getId());
        $this->authorize($request, $entity);

        $item = $this->getProperty($entity, $this->field());
        $this->related()->getEntityManager()->remove($item);
        $this->setProperty($entity, $this->field(), null);

        $this->repository()->getEntityManager()->flush();

        return $this->response()->noContent();
    }
822522
public function sendRequest(Request $request)
    {
        try {
            $rawResponse = $this->processRequest($request);
        } catch (Exception $exception) {
            if ($this->successor) {
                return $this->successor->sendRequest($request);
            }
            throw $exception;
        }

        $response = new Response($request, $rawResponse);

        if ($response->isError()) {
            throw $response->getThrownException();
        }

        return $response;
    }