Uebergibt den Request zur Bearbeitung an die konfigurierte Action und gibt den von ihr
zurueckgegebenen ActionForward zurueck.

@param  Request  $request
@param  Response $response
@param  Action   $action

@return ActionForward|null
355697
protected function processActionExecute(Request $request, Response $response, Action $action) {
        $forward = $throwable = null;

        // Alles kapseln, damit Postprocessing-Hook auch nach Auftreten einer Exception aufgerufen
        // werden kann (z.B. Transaction-Rollback o.ae.)
        try {
            // allgemeinen Preprocessing-Hook aufrufen
            $forward = $action->executeBefore($request, $response);

            // Action nur ausfuehren, wenn executeBefore() nicht schon Abbruch signalisiert hat
            if ($forward === null) {
                // TODO: implement dispatching for DispatchActions; as of now it must be done manually in execute()
                $forward = $action->execute($request, $response);
            }
        }
        catch (\Exception $ex) {
            $throwable = $ex;    // evt. aufgetretene Exception zwischenspeichern
        }

        // falls statt eines ActionForwards ein String-Identifier zurueckgegeben wurde, diesen aufloesen
        if (is_string($forward)) {
            if ($forwardInstance = $action->getMapping()->findForward($forward)) {
                $forward = $forwardInstance;
            }
            else {
                $throwable = new RuntimeException('No ActionForward found for name "'.$forward.'"');
                $forward = null;
            }
        }

        // allgemeinen Postprocessing-Hook aufrufen
        $forward = $action->executeAfter($request, $response, $forward);

        // jetzt evt. aufgetretene Exception weiterreichen
        if ($throwable)
            throw $throwable;

        return $forward;
    }
876947
public function handleAction($action, $actionParams)
    {
        $response = new b8\Http\Response\JsonResponse();
        try {
            $data = parent::handleAction($action, $actionParams);
            if (isset($data['responseCode'])) {
                $response->setResponseCode($data['responseCode']);
                unset($data['responseCode']);
            }
            $response->setContent($data);
        } catch (Exception $ex) {
            $response->setResponseCode(500);
            $response->setContent(array('status' => 'failed', 'error' => $ex->getMessage()));
        }
        return $response;
    }
135261
public function handleAction($request, $action)
    {
        $handles = parent::allowedActions(false);
        $defaultMapping = $this->stat('allowed_actions');
        $handles['index'] = 'handleIndex';
        $siteConfig = SiteConfig::current_site_config();
        foreach ($defaultMapping as $key) {
            $map = ucfirst($key . 'Action');
            if ($siteConfig->$map) {
                $handles[$siteConfig->$map] = $key;
            }
            if (!array_key_exists($key, $handles)) {
                $handles[$key] = $key;
            }
        }
        self::$url_handlers = $handles;
        $this->needsRedirect();

        return parent::handleAction($request, $handles[$action]);
    }
53267
public function beforeAction($action)
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        if (!Yii::$app->session->hasSessionId) {
            throw new BadRequestHttpException('Need an active session');
        }
        return parent::beforeAction($action);
    }
613775
public function doRequest($request, $location, $action, $version, $one_way)
  {
    return $this->__doRequest($request, $location, $action, $version, $one_way);
  }
757995
public function transformEarly(Request $request, SymfonyResponse $response)
    {
        $responseModel = $response->getContent();

        if (!$responseModel instanceof ResponseModelInterface) {
            $responseModel = $this->responseModelFactory->createFromContent(
                $response
            );
        }

        $responseModel->setReturnStackTrace($this->isDebug());
        $response->setStatusCode($responseModel->getStatusCode());
        $this->forceStatusCodeHttpOK($request, $response, $responseModel);
        $response = $this->createSerializedResponse(
            $request,
            $response,
            $responseModel
        );

        return $response;
    }
1374033
public function run(Request $request, Response $response)
    {
        $this->initController($request, $response);
        $event = $this->eventDispatcher->raiseEvent(
            $this->createLoadedEvent()
        );

        if ($event->isHandled() && $event->getResponse() instanceof Response) {
            return $event->getResponse();
        }

        $this->eventDispatcher->raiseEvent(
            $this->createFinishedEvent(
                $this->runController($request, $response)
            )
        );

        return $response;
    }
642048
public function next(Request $request, Response $response, $next)
    {
        // TODO: Implement next() method.

        Events::dispatch('beforeControllerRun', array($this->controller));
        $data = call_user_func_array(array($this->controller, 'run'), $request->params);
        $next($request, $response);
        Events::dispatch('afterControllerRun', array($this->controller, $this->controller->response));
        Events::dispatch('beforeViewDisplay', array($this->controller));
        $t0 = microtime(true);
        $response->setContent($this->controller->display($data, $request->params));
        Events::dispatch('afterViewDisplay', array($this->controller, $t0));
    }
1298967
public function run($action, Request $request, Response $response)
    {
        $this->init();
        if (!$this->initCalled) {
            throw new IllegalStateException("Controller::init() must be called");
        }
        $this->response = $response;
        $this->headers  = $response->getHeaders();

        return $this->{$action . 'Action'}($request, $response);
    }
356045
public function executeCollectionAction($action, Request $request)
    {
        $ids = $request->query->get('ids');

        /** @var ResourceNode[] $resourceNodes */
        $resourceNodes = $this->om->findList(ResourceNode::class, 'uuid', $ids);
        $responses = [];

        // read request and get user query
        $parameters = $request->query->all();
        $content = null;

        if (!empty($request->getContent())) {
            $content = json_decode($request->getContent(), true);
        }
        $files = $request->files->all();

        $this->om->startFlushSuite();

        foreach ($resourceNodes as $resourceNode) {
            // check the requested action exists
            if (!$this->actionManager->support($resourceNode, $action, $request->getMethod())) {
                // undefined action
                throw new NotFoundHttpException(
                    sprintf('The action %s with method [%s] does not exist for resource type %s.', $action, $request->getMethod(), $resourceNode->getResourceType()->getName())
                );
            }

            // check current user rights
            $this->checkAccess($this->actionManager->get($resourceNode, $action), [$resourceNode]);

            // dispatch action event
            $responses[] = $this->actionManager->execute($resourceNode, $action, $parameters, $content, $files);
        }

        $this->om->endFlushSuite();

        return new JsonResponse(array_map(function (Response $response) {
            return json_decode($response->getContent(), true);
        }, $responses));
    }
259015
public function next(Request $request, Response $response, $next)
    {
        if ($this->login()) {
            $next($request, $response);
        }
        // TODO: Implement next() method.
    }
609221
public function auth(Request $request, $action)
    {
        $provider = strtolower($request->attributes->get('provider'));

        if (! $this->providerExists($provider)) {
            return $this->createNotFoundResponse();
        }

        $service = $this->getServiceByProvider($provider);

        $redirectUri = $service->getAuthorizationUri(['state' => $action]);

        $response = new Response();
        $response->setStatusCode(301);
        $response->headers->set('Location', (string) $redirectUri);
        return $response;
    }
1071247
public function next(Request $request, Response $response, $next)
    {
        $response->setContentType('text/json');
        $next($request, $response);
    }
1256553
public function handleAction($request, $action)
    {
        // if we submitted a form, let that pass
        if (!$request->isGET() && !$request->isHEAD()) {
            return parent::handleAction($request, $action);
        }

        $url = $request->getURL();

        //
        // If the current request has an extension attached to it, strip that
        // off and redirect the user to the page without an extension.
        //
        if (DocumentationHelper::get_extension($url)) {
            $this->response = new SS_HTTPResponse();
            $this->response->redirect(
                Director::absoluteURL(DocumentationHelper::trim_extension_off($url)) .'/',
                301
            );

            $request->shift();
            $request->shift();

            return $this->response;
        }

        //
        // Strip off the base url
        //
        $base = ltrim(
            Config::inst()->get('DocumentationViewer', 'link_base'),
            '/'
        );

        if ($base && strpos($url, $base) !== false) {
            $url = substr(
                ltrim($url, '/'),
                strlen($base)
            );
        }

        //
        // Handle any permanent redirections that the developer has defined.
        //
        if ($link = DocumentationPermalinks::map($url)) {
            // the first param is a shortcode for a page so redirect the user to
            // the short code.
            $this->response = new SS_HTTPResponse();
            $this->response->redirect($link, 301);

            $request->shift();
            $request->shift();

            return $this->response;
        }

        //
        // Validate the language provided. Language is a required URL parameter.
        // as we use it for generic interfaces and language selection. If
        // language is not set, redirects to 'en'
        //
        $languages = i18n::get_common_languages();

        if (!$lang = $request->param('Lang')) {
            $lang = $request->param('Action');
            $action = $request->param('ID');
        } else {
            $action = $request->param('Action');
        }

        if (!$lang) {
            return $this->redirect($this->Link('en'));
        } elseif (!isset($languages[$lang])) {
            return $this->httpError(404);
        }

        $request->shift(10);

        $allowed = $this->config()->allowed_actions;

        if (in_array($action, $allowed)) {
            //
            // if it's one of the allowed actions such as search or all then the
            // URL must be prefixed with one of the allowed languages and versions
            //
            return parent::handleAction($request, $action);
        } else {
            //
            // look up the manifest to see find the nearest match against the
            // list of the URL. If the URL exists then set that as the current
            // page to match against.

            // strip off any extensions.


            // if($cleaned !== $url) {
            // 	$redirect = new SS_HTTPResponse();

            // 	return $redirect->redirect($cleaned, 302);
            // }
            if ($record = $this->getManifest()->getPage($url)) {
                // In SS 3 offsetSet() isn't implemented for some reason... this is a workaround
                $routeParams = $this->request->routeParams();
                $routeParams['Lang'] = $lang;
                $this->request->setRouteParams($routeParams);

                $this->record = $record;
                $this->init();

                $type = get_class($this->record);
                $body = $this->renderWith(
                    array(
                        "DocumentationViewer_{$type}",
                        'DocumentationViewer'
                    )
                );

                return new SS_HTTPResponse($body, 200);
            } elseif ($redirect = $this->getManifest()->getRedirect($url)) {
                $response = new SS_HTTPResponse();
                $to = Controller::join_links(Director::baseURL(), $base, $redirect);
                return $response->redirect($to, 301);
            } elseif (!$url || $url == $lang) {
                $body = $this->renderWith(
                    array(
                        'DocumentationViewer_DocumentationFolder',
                        'DocumentationViewer'
                    )
                );

                return new SS_HTTPResponse($body, 200);
            }
        }

        return $this->httpError(404);
    }
1267913
public function prepareResponse($request, $response)
    {
        if (! $response instanceof SymfonyResponse) {
            $response = new Response($response);
        }

        return $response->prepare($request);
    }
353346
protected function createApiException(Request $request, Response $response)
    {
        //$errors = json_decode((string) $response->getBody());

        return new HttpRequestException(
            $response->getCode(),
            $response->getBody(),
            $request,
            $response
        );
    }
1198069
private function getInfoResponse(Request $request, Response $response)
    {
        try {
            $this->video->getJson();
        } catch (PasswordException $e) {
            return $this->password($request, $response);
        }

        if (isset($this->video->entries)) {
            $template = 'playlist.tpl';
        } else {
            $template = 'info.tpl';
        }
        $title = _('Video download');
        $description = _('Download video from ').$this->video->extractor_key;
        if (isset($this->video->title)) {
            $title = $this->video->title;
            $description = _('Download').' "'.$this->video->title.'" '._('from').' '.$this->video->extractor_key;
        }
        $this->view->render(
            $response,
            $template,
            [
                'video'         => $this->video,
                'class'         => 'info',
                'title'         => $title,
                'description'   => $description,
                'config'        => $this->config,
                'canonical'     => $this->getCanonicalUrl($request),
                'locale'        => $this->localeManager->getLocale(),
                'defaultFormat' => $this->defaultFormat,
            ]
        );

        return $response;
    }