Applies the defined strategies on the provided request.

@param Request $request request to handle

@return string
965362
public function apply(Request $request)
    {
        foreach ($this->strategies as $strategy) {
            $name = $strategy->apply($request);
            if ($strategy->stopPropagation()) {
                $this->roles = $strategy->getRoles();
                return $name;
            }
        }

        return false;
    }
1226132
public function gridAction(Request $request)
    {
        return $this->processView('grid', $this->view([
            'form' => $form = $this->submitGrid($grid = $this->buildGrid(), $request),
            'grid' => $this->getGridHandler()->handle($grid, $form),
        ]));
    }
1349644
public function indexAction( Request $request )
	{
		if( $this->hasRole( ['ROLE_ADMIN', 'ROLE_SUPER_ADMIN'] ) )
		{
			$context = $this->get( 'aimeos.context' )->get( false );
			$siteManager = \Aimeos\MShop::create( $context, 'locale/site' );
			$user = $this->get( 'security.token_storage' )->getToken()->getUser();
			$siteCode = ( $user->getSiteId() ? $siteManager->getItem( $user->getSiteId() )->getCode() : 'default' );
			$locale = $user->getLanguageId() ?: $this->getParameter( 'locale' );

			$params = array(
				'resource' => 'dashboard',
				'site' => $request->attributes->get( 'site', $request->query->get( 'site', $siteCode ) ),
				'lang' => $request->attributes->get( 'lang', $request->query->get( 'lang', $locale ) ),
			);
			return $this->redirect( $this->generateUrl( 'aimeos_shop_jqadm_search', $params ) );
		}


		$param = array( 'error' => '', 'username' => '' );

		if( $this->has( 'security.authentication_utils' ) )
		{
			$auth = $this->get( 'security.authentication_utils' );

			$param['error'] = $auth->getLastAuthenticationError();
			$param['username'] = $auth->getLastUsername();
		}

		return $this->render( 'AimeosShopBundle:Admin:index.html.twig', $param );
	}
412511
public function shellAction(Request $request)
    {
        $this->translator->setLocale($request->getPreferredLanguage() ?: $request->getDefaultLocale());

        return $this->render(
            'eZPlatformUIBundle:PlatformUI:shell.html.twig',
            ['parameters' => $this->configAggregator->getConfig()]
        );
    }
999953
public function slash(Request $request)
    {
        switch ($emailStatus = $request->query->get('email')) {
            case 'sent';
                $emailStatus = $this->app->trans('Mail sent');
                break;
            case 'error':
                $emailStatus = $this->app->trans('Could not send email');
                break;
        }

        return $this->render('admin/dashboard.html.twig', [
            'cache_flushed' => $request->query->get('flush_cache') === 'ok',
            'admins'        => $this->getUserRepository()->findAdmins(),
            'email_status'  => $emailStatus,
        ]);
    }
1210152
public function optionsAction(Request $request)
    {
        list($app, $module, , $modelName) = explode('.', $request->attributes->get('_route'));

        $response = $this->response;
        $response->setStatusCode(Response::HTTP_NO_CONTENT);

        // enabled methods for CorsListener
        $corsMethods = 'GET, POST, PUT, PATCH, DELETE, OPTIONS';
        try {
            $router = $this->getRouter();
            // if post route is available we assume everything is readable
            $router->generate(implode('.', array($app, $module, 'rest', $modelName, 'post')));
        } catch (RouteNotFoundException $exception) {
            // only allow read methods
            $corsMethods = 'GET, OPTIONS';
        }
        $request->attributes->set('corsMethods', $corsMethods);

        return $response;
    }
178305
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);
        $this->app->make('Illuminate\Contracts\Http\Kernel')->terminate($request, $response);

        return $response;
    }
131294
public function searchAction(Request $request)
    {
        $searchAction = $this->container->get(SearchAction::class);

        return $searchAction($request);
    }
735778
public function handle(Request $request)
    {
        //get the correct method
        if ($this->method === 'GET') {
            $values = $request->query->all();
        } else {
            $values = $request->request->all();
        }

        // The form is submitted if at least one field is present
        if (count(array_intersect_key($values, $this->rows)) > 0) {
            return $this->submitForm($values);
        }
    }
31103
private function transformRequest(Request $request)
    {
        $method = $request->getMethod();
        $url = (string) $request->getUrl();

        $transformed = $this->browser->getMessageFactory()->createRequest($method, $url);

        $transformed->setProtocolVersion($request->getProtocolVersion());
        $transformed->setHeaders($request->getHeaders());

        if ($body = $request->getBody()) {
            $transformed->setContent((string) $body);
        }

        return $transformed;
    }
2864
protected function AnalyzeRequest(&$Request) {
   
      // Here is the basic format of a request:
      // [/application]/controller[/method[.json|.xml]]/argn|argn=valn

      // Here are some examples of what this method could/would receive:
      // /application/controller/method/argn
      // /controller/method/argn
      // /application/controller/argn
      // /controller/argn
      // /controller

      // Clear the slate
      $this->_ApplicationFolder = '';
      $this->ControllerFolder = '';
      $this->ControllerName = '';
      $this->ControllerMethod = 'index';
      $this->_ControllerMethodArgs = array();
      $this->Request = $Request->Path(FALSE);

      $PathAndQuery = $Request->PathAndQuery();
      $MatchRoute = Gdn::Router()->MatchRoute($PathAndQuery);
      
      // We have a route. Take action.
      if ($MatchRoute !== FALSE) {
         switch ($MatchRoute['Type']) {
            case 'Internal':
               $Request->PathAndQuery($MatchRoute['FinalDestination']);
               $this->Request = $Request->Path(FALSE);
               break;

            case 'Temporary':
               header("HTTP/1.1 302 Moved Temporarily" );
               header("Location: ".Url($MatchRoute['FinalDestination']));
               exit();
               break;

            case 'Permanent':
               header("HTTP/1.1 301 Moved Permanently" );
               header("Location: ".Url($MatchRoute['FinalDestination']));
               exit();
               break;

            case 'NotAuthorized':
               header("HTTP/1.1 401 Not Authorized" );
               $this->Request = $MatchRoute['FinalDestination'];
               break;

            case 'NotFound':
               header("HTTP/1.1 404 Not Found" );
               $this->Request = $MatchRoute['FinalDestination'];
               break;
            case 'Test':
               $Request->PathAndQuery($MatchRoute['FinalDestination']);
               $this->Request = $Request->Path(FALSE);
               decho($MatchRoute, 'Route');
               decho(array(
                  'Path' => $Request->Path(),
                  'Get' => $Request->Get()
                  ), 'Request');
               die();
         }
      }
      
      switch ($Request->OutputFormat()) {
         case 'rss':
            $this->_SyndicationMethod = SYNDICATION_RSS;
            break;
         case 'atom':
            $this->_SyndicationMethod = SYNDICATION_ATOM;
            break;
         case 'default':
         default:
            $this->_SyndicationMethod = SYNDICATION_NONE;
            break;
      }

      if ($this->Request == '') {
         $DefaultController = Gdn::Router()->GetRoute('DefaultController');
         $this->Request = $DefaultController['Destination'];
      }

      $Parts = explode('/', str_replace('\\', '/', $this->Request));

      /**
       * The application folder is either the first argument or is not provided. The controller is therefore
       * either the second argument or the first, depending on the result of the previous statement. Check that.
       */
      try {
         // if the 1st argument is a valid application, check if it has a controller matching the 2nd argument
         if (in_array($Parts[0], $this->EnabledApplicationFolders()))
            $this->FindController(1, $Parts);

         // if no match, see if the first argument is a controller
         $this->FindController(0, $Parts);

         // 3] See if there is a plugin trying to create a root method.
         list($MethodName, $DeliveryMethod) = $this->_SplitDeliveryMethod(GetValue(0, $Parts), TRUE);
         if ($MethodName && Gdn::PluginManager()->HasNewMethod('RootController', $MethodName, TRUE)) {
            $this->_DeliveryMethod = $DeliveryMethod;
            $Parts[0] = $MethodName;
            $Parts = array_merge(array('root'), $Parts);
            $this->FindController(0, $Parts);
         }

         throw new GdnDispatcherControllerNotFoundException();
      } catch (GdnDispatcherControllerFoundException $e) {

         switch ($this->_DeliveryMethod) {
            case DELIVERY_METHOD_JSON:
            case DELIVERY_METHOD_XML:
               $this->_DeliveryType = DELIVERY_TYPE_DATA;
               break;
            case DELIVERY_METHOD_TEXT:
               $this->_DeliveryType = DELIVERY_TYPE_VIEW;
               break;
            case DELIVERY_METHOD_XHTML:
            case DELIVERY_METHOD_RSS:
               break;
            default:
               $this->_DeliveryMethod = DELIVERY_METHOD_XHTML;
               break;
         }

         return TRUE;
      } catch (GdnDispatcherControllerNotFoundException $e) {
         $this->EventArguments['Handled'] = FALSE;
         $Handled =& $this->EventArguments['Handled'];
         $this->FireEvent('NotFound');
         
         if (!$Handled) {
            header("HTTP/1.1 404 Not Found");
            $Request->WithRoute('Default404');
            return $this->AnalyzeRequest($Request);
         }
      }
   }
314338
public function getRouteForRequest(Request $request)
    {
        $routes = $this->collection->get($request->getMethod());

        return $this->check($routes, $request);
    }
277690
public function HandleRequest($request)
    {
        if ($this->typesInfos()->contains('image')) {
            $name = $this->type->search('image');
            if ($request[$name]) {
                $image = $this->upload($request[$name]);
                $request[$name] = $image;
            }
        }

        if ($this->typesInfos()->contains('select_multiple')) {
            $name = $this->type->search('select_multiple');
            if ($request[$name]) {
                $request[$name] = json_encode($request[$name]);
            }
        }
        return $request;
    }
1199000
public function request(string $request): string
    {
        $request  = $this->preRequest($request);
        return $this->send($request);
    }
264037
public function handle(Request $request)
    {
        $pathInfo = $request->getPathInfo();

        if (0 === strpos($pathInfo, $this->basePath)) {
            foreach ($this->routes as $config) {
                list($method, $pattern, $controller) = $config;

                if ($request->getMethod() === strtoupper($method)
                    && preg_match('!^' . preg_quote($this->basePath . $pattern, '!') . '$!', $request->getPathInfo())
                ) {
                    return call_user_func($controller, $request);
                }
            }
        }

        return null;
    }
1231943
public function handleRequest($request)
    {
        // recursion for batch
        if ($request->isBatch()) {
            $batch = array();
            foreach ($request->requests as $req) {
                $batch[] = $this->handleRequest($req);
            }
            $responses = implode(',',array_filter($batch, function($a){return $a !== null;}));
            if ($responses != null) {
                return "[{$responses}]";
            } else {
                return null;
            }
        }

        // check validity of request
        if ($request->checkValid()) {
            // check for method existence
            if (!$this->methodExists($request->method)) {
                $request->error_code = ERROR_METHOD_NOT_FOUND;
                $request->error_message = "Method not found.";
                return $request->toResponseJSON();
            }

            // try to call method with params
            try {
                $response = $this->invokeMethod($request->method, $request->params);
                if (!$request->isNotify()) {
                    $request->result = $response;
                } else {
                    return null;
                }
            // handle exceptions
            } catch (\Exception $e) {
                $request->error_code = ERROR_EXCEPTION;
                $request->error_message = $e->getMessage();
            }
        }

        // return whatever we got
        return $request->toResponseJSON();
    }
1170837
public static function convertRequestToCurlCommand(Request $request)
    {
        $message = 'curl -X'.\strtoupper($request->getMethod()).' ';
        $message .= '\'http://'.$request->getConnection()->getHost().':'.$request->getConnection()->getPort().'/';
        $message .= $request->getPath();

        $query = $request->getQuery();
        if (!empty($query)) {
            $message .= '?'.\http_build_query($query);
        }

        $message .= '\'';

        $data = $request->getData();
        if (!empty($data)) {
            $message .= ' -d \''.JSON::stringify($data).'\'';
        }

        return $message;
    }