Runs through the request, by using the configuration to obtain correct handlers.

Override ezcMvcConfigurableDispatcher::run() to handle
ezpRouteMethodNotAllowedException exception thrown when a route was
found but an unexpected method is used.
342362
public function run()
    {
        // initialize infinite loop counter
        $redirects = 0;

        // create the request
        $requestParser = $this->getRequestParser();
        $request = $requestParser->createRequest();

        // start of the request loop
        do
        {
            // do the infinite loop check
            $this->checkRedirectLimit( $redirects );
            $continue = false;

            // run pre-routing filters
            $this->configuration->runPreRoutingFilters( $request );

            // create the router from the configuration
            $router = $this->getRouter( $request );

            // router creates routing information
            try
            {
                $routingInformation = $router->getRoutingInformation();
            }
            catch ( ezcMvcRouteNotFoundException $e )
            {
                $request = $this->getFatalRedirectRequest( $request, new ezcMvcResult, $e );
                $continue = true;
                continue;
            }
            // here's the reason to override ezcMvcConfigurableDispatcher::run()
            catch ( ezpRouteMethodNotAllowedException $e )
            {
                $request = $this->getFatalRedirectRequest( $request, new ezcMvcResult, $e );
                $continue = true;
                continue;
            }
            // end diff


            // run request filters
            $filterResult = $this->configuration->runRequestFilters( $routingInformation, $request );

            if ( $filterResult instanceof ezcMvcInternalRedirect )
            {
                $request = $filterResult->request;
                $continue = true;
                continue;
            }

            // create the controller
            $controller = $this->getController( $routingInformation, $request );

            // run the controller
            try
            {
                $result = $controller->createResult();
            }
            catch ( Exception $e )
            {
                $request = $this->getFatalRedirectRequest( $request, new ezcMvcResult, $e );
                $continue = true;
                continue;
            }

            if ( $result instanceof ezcMvcInternalRedirect )
            {
                $request = $result->request;
                $continue = true;
                continue;
            }
            if ( !$result instanceof ezcMvcResult )
            {
                throw new ezcMvcControllerException( "The action '{$routingInformation->action}' of controller '{$routingInformation->controllerClass}' did not return an ezcMvcResult object." );
            }

            $this->configuration->runResultFilters( $routingInformation, $request, $result );

            if ( $result->status !== 0 )
            {
                $response = new ezcMvcResponse;
                $response->status = $result->status;
            }
            else
            {
                // want the view manager to use my filters
                $view = $this->getView( $routingInformation, $request, $result );

                // create the response
                try
                {
                    $response = $view->createResponse();
                }
                catch ( Exception $e )
                {
                    $request = $this->getFatalRedirectRequest( $request, $result, $e );
                    $continue = true;
                    continue;
                }
            }
            $this->configuration->runResponseFilters( $routingInformation, $request, $result, $response );

            // create the response writer
            $responseWriter = $this->getResponseWriter( $routingInformation, $request, $result, $response );

            // handle the response
            $responseWriter->handleResponse();
        }
        while ( $continue );
    }
1103949
public function run() {
		if ( !isset($_REQUEST[$this->cmdVar]) )
			throw new Exception('No task specified.');
		elseif ( !in_array($_REQUEST[$this->cmdVar], $this->auth_exceptions) && !$this->auth() )
			throw new Exception('Authentication required.');

		$this->runJSON();
	}
760224
protected function runObject()
    {
        $targetInfos = $this->ctrlRouterInfos->target;
        
        if (
            !is_array($targetInfos) ||
            (is_array($targetInfos) && count($targetInfos) !== 2)
        ) {
            throw new Exception(
                'The route target should be an array with the class name '
                .'(first value) and the method name (second value).',
                self::ERR_RUN_OBJECT_MISSING_DATAS_INTO_TARGET
            );
        }
        
        $class  = $targetInfos[0];
        $method = $targetInfos[1];
        
        if (!class_exists($class)) {
            throw new Exception(
                'Class '.$class.' not found',
                self::ERR_RUN_OBJECT_CLASS_NOT_FOUND
            );
        }
        
        $classInstance = new $class;
        if (!method_exists($classInstance, $method)) {
            throw new Exception(
                'Method '.$method.' not found in class '.$class,
                self::ERR_RUN_OBJECT_METHOD_NOT_FOUND
            );
        }
        
        $classInstance->{$method}();
    }
489537
public function run()
    {
        $block = ob_get_clean();
        if ($this->renderInPlace) {
            throw new Exception("not implemented yet ! ");
        }
        $block = trim($block);
        $cssBlockPattern = '|^<style[^>]*>(?P<blockContent>.+?)</style>$|is';
        if (preg_match($cssBlockPattern, $block, $matches)) {
            $block = $matches['blockContent'];
        }
        $this->view->registerCss($block, $this->options, $this->key);
    }
669657
public function run()
    {
        if ($this->is_route == true) {
            if ($this->segments instanceof \Closure) {
                echo call_user_func($this->segments);
                die();
            } else {
                $class = $this->getBundleUrl();
            }
        } else {
            $class = $this->getUnBundleUrl();

            if (!class_exists($class)) {

                $this->initDefaultRoute();

                $class = $this->getBundleUrl();
            }
        }

        if (!class_exists($class)) {
            $message = sprintf('No route found for "%s %s"', Zilf::$container['request']->getMethod(), Zilf::$container['request']->getPathInfo());

            if ($referer = Zilf::$container['request']->headers->get('referer')) {
                $message .= sprintf(' (from "%s")', $referer);
            }
            throw new NotFoundHttpException($message);
        }

        unset($this->segments);

        //将参数追加到GET里面
        if (!empty($this->params)) {
            foreach ($this->params as $key => $row) {
                if (is_string($key)) {
                    $_GET[$key] = $row;
                } else {
                    $_GET['zget' . $key] = $row;
                }
            }
            Zilf::$container->getShare('request')->query->add($_GET);
        }

        $object = Zilf::$container->build($class, []);
        if (method_exists($object, $this->action)) {

            $response = call_user_func_array(array($object, $this->action), $this->params);
            if (!$response instanceof Response) {
                $msg = sprintf('The controller must return a response (%s given).', $this->varToString($response));

                // the user may have forgotten to return something
                if (null === $response) {
                    $msg .= ' Did you forget to add a return statement somewhere in your controller?';
                }
                throw new \LogicException($msg);
            }
            $response->send();

        } else {
            throw new \Exception('类: ' . $class . ' 调用的方法：' . $this->action . ' 不存在！');
        }
    }
355208
public function run()
    {
        if (PHP_SAPI === 'cli' && is_subclass_of($this, ConsoleAppInterface::class))
        {
            $this->execConsoleApp();
        }
        else if (is_subclass_of($this, WebAppInterface::class))
        {
            $this->execWebApp();
        }
        else
        {
            throw new \Exception("No interface was implemented");
        }
    }
62983
public function run()
    {
        $this->run_called = true;
        $this->hook('beforeRender');
        $this->is_rendering = true;

        // if no App layout set
        if (!isset($this->html)) {
            throw new Exception(['App layout should be set.']);
        }

        $this->html->template->set('title', $this->title);
        $this->html->renderAll();
        $this->html->template->appendHTML('HEAD', $this->html->getJS());
        $this->is_rendering = false;
        $this->hook('beforeOutput');

        if (isset($_GET['__atk_callback']) && $this->catch_runaway_callbacks) {
            $this->terminate('!! Callback requested, but never reached. You may be missing some arguments in '.$_SERVER['REQUEST_URI']);
        }

        echo $this->html->template->render();
    }
347604
function run() {
		if ($this->blacklisted($this->hive['IP']))
			// Spammer detected
			$this->error(403);
		if (!$this->hive['ROUTES'])
			// No routes defined
			user_error(self::E_Routes,E_USER_ERROR);
		// Match specific routes first
		$paths=array();
		foreach ($keys=array_keys($this->hive['ROUTES']) as $key)
			$paths[]=str_replace('@','*@',$key);
		$vals=array_values($this->hive['ROUTES']);
		array_multisort($paths,SORT_DESC,$keys,$vals);
		$this->hive['ROUTES']=array_combine($keys,$vals);
		// Convert to BASE-relative URL
		$req=$this->rel($this->hive['URI']);
		if ($cors=(isset($this->hive['HEADERS']['Origin']) &&
			$this->hive['CORS']['origin'])) {
			$cors=$this->hive['CORS'];
			header('Access-Control-Allow-Origin: '.$cors['origin']);
			header('Access-Control-Allow-Credentials: '.
				($cors['credentials']?'true':'false'));
		}
		$allowed=array();
		foreach ($this->hive['ROUTES'] as $pattern=>$routes) {
			if (!$args=$this->mask($pattern,$req))
				continue;
			ksort($args);
			$route=NULL;
			if (isset(
				$routes[$ptr=$this->hive['AJAX']+1][$this->hive['VERB']]))
				$route=$routes[$ptr];
			elseif (isset($routes[self::REQ_SYNC|self::REQ_AJAX]))
				$route=$routes[self::REQ_SYNC|self::REQ_AJAX];
			if (!$route)
				continue;
			if ($this->hive['VERB']!='OPTIONS' &&
				isset($route[$this->hive['VERB']])) {
				$parts=parse_url($req);
				if ($this->hive['VERB']=='GET' &&
					preg_match('/.+\/$/',$parts['path']))
					$this->reroute(substr($parts['path'],0,-1).
						(isset($parts['query'])?('?'.$parts['query']):''));
				list($handler,$ttl,$kbps,$alias)=$route[$this->hive['VERB']];
				if (is_bool(strpos($pattern,'/*')))
					foreach (array_keys($args) as $key)
						if (is_numeric($key) && $key)
							unset($args[$key]);
				// Capture values of route pattern tokens
				$this->hive['PARAMS']=$args=array_map('urldecode',$args);
				// Save matching route
				$this->hive['ALIAS']=$alias;
				$this->hive['PATTERN']=$pattern;
				if ($cors && $cors['expose'])
					header('Access-Control-Expose-Headers: '.(is_array($cors['expose'])?
						implode(',',$cors['expose']):$cors['expose']));
				if (is_string($handler)) {
					// Replace route pattern tokens in handler if any
					$handler=preg_replace_callback('/@(\w+\b)/',
						function($id) use($args) {
							return isset($args[$id[1]])?$args[$id[1]]:$id[0];
						},
						$handler
					);
					if (preg_match('/(.+)\h*(?:->|::)/',$handler,$match) &&
						!class_exists($match[1]))
						$this->error(404);
				}
				// Process request
				$result=NULL;
				$body='';
				$now=microtime(TRUE);
				if (preg_match('/GET|HEAD/',$this->hive['VERB']) && $ttl) {
					// Only GET and HEAD requests are cacheable
					$headers=$this->hive['HEADERS'];
					$cache=Cache::instance();
					$cached=$cache->exists(
						$hash=$this->hash($this->hive['VERB'].' '.
							$this->hive['URI']).'.url',$data);
					if ($cached && $cached[0]+$ttl>$now) {
						if (isset($headers['If-Modified-Since']) &&
							strtotime($headers['If-Modified-Since'])+
								$ttl>$now) {
							$this->status(304);
							die;
						}
						// Retrieve from cache backend
						list($headers,$body,$result)=$data;
						if (PHP_SAPI!='cli')
							array_walk($headers,'header');
						$this->expire($cached[0]+$ttl-$now);
					}
					else
						// Expire HTTP client-cached page
						$this->expire($ttl);
				}
				else
					$this->expire(0);
				if (!strlen($body)) {
					if (!$this->hive['RAW'] && !$this->hive['BODY'])
						$this->hive['BODY']=file_get_contents('php://input');
					ob_start();
					// Call route handler
					$result=$this->call($handler,array($this, $args),
						'beforeroute,afterroute');
					$body=ob_get_clean();
					// Template Parsing
					if ($this->hive['TEMPLATE']) {
						$this->hive['RESPONSE'] = $body;
						$body = $this->send($this->hive['TEMPLATE'], true);
					}
					if (isset($cache) && !error_get_last()) {
						// Save to cache backend
						$cache->set($hash,array(
							// Remove cookies
							preg_grep('/Set-Cookie\:/',headers_list(),
								PREG_GREP_INVERT),$body,$result),$ttl);
					}
				}
				$this->hive['RESPONSE']=$body;
				if (!$this->hive['QUIET']) {
					if ($kbps) {
						$ctr=0;
						foreach (str_split($body,1024) as $part) {
							// Throttle output
							$ctr++;
							if ($ctr/$kbps>($elapsed=microtime(TRUE)-$now) &&
								!connection_aborted())
								usleep(1e6*($ctr/$kbps-$elapsed));
							echo $part;
						}
					}
					else
						echo $body;
				}
				return $result;
			}
			$allowed=array_merge($allowed,array_keys($route));
		}
		if (!$allowed)
			// URL doesn't match any route
			$this->error(404);
		elseif (PHP_SAPI!='cli') {
			// Unhandled HTTP method
			header('Allow: '.implode(',',array_unique($allowed)));
			if ($cors) {
				header('Access-Control-Allow-Methods: OPTIONS,'.implode(',',$allowed));
				if ($cors['headers'])
					header('Access-Control-Allow-Headers: '.(is_array($cors['headers'])?
						implode(',',$cors['headers']):$cors['headers']));
				if ($cors['ttl']>0)
					header('Access-Control-Max-Age: '.$cors['ttl']);
			}
			if ($this->hive['VERB']!='OPTIONS')
				$this->error(405);
		}
		return FALSE;
	}
1211173
public function run() {
		if ($this->url === null) {
			throw new \Exception("No URL configured for redirection.");
		}
		if (strpos($this->url, '/') === 0 || strpos($this->url, 'http://') === 0 || strpos($this->url, 'https://') === 0) {
			$url = ValueUtils::val($this->url);
		} else {
			$url = ROOT_URL.ValueUtils::val($this->url);
		}
		header("Location: ".$url);
	}
260611
protected function _run()
    {
//        $class = $this->modelClass;
//        $class::initNavigationPagesById($this->actionParams->get['id']);
        $pageId = \yii::$app->request->getQueryParam('id');
        if ($pageId) {
            $pages = FrontendPage::getNavigationPages($pageId);
            if (empty($pages)) {
                throw new NotFoundHttpException();
            }
        }

        return $this->getResponse([
            'content' => [],
        ]);
    }
1320495
public function run()
    {
        $request = $this->request;
        $response = $this->response;
        $config = $this->configuration;

        $httpMethod = $request->getMethod();
        $pathInfo = $request->getUri()->getPath();
        if (empty($pathInfo)) {
            $pathInfo = '/';
        }

        $routeObject = $this->router->resolve($pathInfo, $httpMethod);
        if($routeObject) {
            $middlewareList = [];
            if (isset($routeObject['middleware'])) {
                $middlewareConfig = $config->get('middlewares');
                $middlewareCount = count($routeObject['middleware']);
                $middlewareNext = null;
                $middlewareFactory = $this->container->get(MiddlewareFactory::class);

                for ($i=$middlewareCount-1; $i >= 0; $i--) {
                    $middlewareName = $routeObject['middleware'][$i];
                    $middlewareClass = $middlewareConfig[$middlewareName];
                    $middlewareList[$i] = $middlewareFactory->createObject($middlewareClass, [
                        'response' => $response,
                        'next' => $middlewareNext,
                    ]);
                    $middlewareNext = $middlewareList[$i];
                }
            }

            $baseNamespace = $config->get('controllersNamespace');
            $handler = $this->convertCallbackToClosure($routeObject['handler'], $baseNamespace);
            $params = isset($routeObject['params']) ? $routeObject['params'] : [];
            $requestHandler = new ServerRequestHandler($response, $handler, $routeObject['params']);

            if (isset($middlewareList[0])) {
                $response = $middlewareList[0]->process($request, $requestHandler);
            } else {
                $response = $requestHandler->handle($request);
            }

        } else {
            throw new HttpException(404, "Route '{$pathInfo}' not found");
        }

        $this->emitResponse($response);
    }
702206
public function can_run() {
		// This handler can only run when we have an application defined
		if (class_exists('\\Skeleton\\Core\\Application') === false) {
			return false;
		}
		
		try {
			\Skeleton\Core\Application::get();
			return true;
		} catch (\Exception $e) {};

		return false;
	}
327278
public function run()
    {
        $this->tryAssignController();
        if (!$this->isControllerAssigned()) {
            throw new Exception("It's unable to assign controller to this route path.");
        }
        $oCtrl = $this->createCtrl();
        $oCtrl->{$this->actionName}($this->actionArgs);
    }
958662
public function run()
    {
        try
        {
            $this['triggers']->callTrigger('before-match-request', $this);

            $this['request']->attributes->add(
                $this['router']->matchRequest($this['request'])
            );

            $this['triggers']->callTrigger('before-controller-resolver', $this);

            $this['response'] = $this->controllerResolver();
        }
        catch (ResourceNotFoundException $e)
        {
            $this['response'] = (new Controller($this))->serve404();
        }
        catch (\Exception $e)
        {
            $this['response'] = new Response();
            $this['response']->headers->set('Content-Type', 'text/plain');
            $this['response']->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);
            $this['response']->setContent($e->getMessage());
        }

        if ($this['x-frame-options']) {
            $this['response']->headers->set('x-frame-options', $this['x-frame-options']);
        }

        $this['response']->prepare($this['request']);

        $this['triggers']->callTrigger('before-send-response', $this);

        $this['response']->send();
    }
1283323
public static function run()
    {
        if (!pass('validate_request', 'route/' . self::$_base)) {
            return;
        };

        if (self::$_base !== null  &&  !pass('route/' . self::$_base, self::$_PATH)) {
            trigger('http_status', 500);
        };
    }
49818
public function run()
    {
        // The MVP process is here ...
        /* @var Psr\Http\Message\ResponseInterface $response */
        $response  = $this->getResponse();
        $presenter = $this->getPresenter();
        $action    = $this->getAction();
        $view      = $this->getView();

        // Use inofficial standard "xAction()"
        $method = $action.'Action';

        // Validate that request mapped to a route (foo:bar) can be executed by Doozr
        if (true === $httpStatus = $this->validateRequest($presenter, $method)) {

            // If we have a view attach it
            if (null !== $view && $view instanceof Doozr_Base_View) {
                $presenter->attach($view);
            }

            // Call the requested Action on requested Presenter (Presenter:Action)
            $data = $presenter->{$method}();

            // Create a response body with write access
            $responseBody = new Doozr_Response_Body('php://memory', 'w');
            $responseBody->write($data[Doozr_Base_Presenter::IDENTIFIER_VIEW]);

            $response = $response->withBody($responseBody);
            $response = $response->withStatus(Doozr_Http::OK);
        } else {
            // So if the Status is not TRUE (successful) it contains an integer for HTTP Response :)
            switch ($httpStatus) {
                case Doozr_Http::BAD_REQUEST:
                    $message = sprintf(
                        'No Presenter to execute route ("%s"). Sure it exists?',
                        $this->getRoute()
                    );
                    break;

                case Doozr_Http::NOT_FOUND:
                default:
                    $message = sprintf(
                        'Method "%s()" of class "%s" not callable. Sure it exists and it\'s public?',
                        $method,
                        'Presenter_'.ucfirst($this->getClassName())
                    );
                    break;
            }

            throw new Doozr_Route_Exception(
                $message,
                $httpStatus
            );
        }

        // Return all data returned and fetched in data
        return $response;
    }
201602
public function run(): void
    {
        try {
            /** @var \Ffcms\Core\Arch\Controller $callClass */
            $callClass = $this->getCallbackClass();
            $callMethod = 'action' . self::$Request->getAction();
            $arguments = self::$Request->getArguments();

            // check if callback method (action) is exist in class object
            if (!method_exists($callClass, $callMethod)) {
                throw new NotFoundException('Method "' . App::$Security->strip_tags($callMethod) . '()" not founded in "' . get_class($callClass) . '"');
            }

            // check if method arguments counts equals passed count
            $requiredArgCount = $this->getMethodRequiredArgCount($callClass, $callMethod);

            // compare method arg count with passed
            if (count($arguments) < $requiredArgCount) {
                throw new NotFoundException(__('Arguments for method %method% is not enough. Expected: %required%, got: %current%.', [
                    'method' => $callMethod,
                    'required' => $requiredArgCount,
                    'current' => count($arguments)
                ]));
            }

            // make callback call to action in controller and get response
            $response = call_user_func_array([$callClass, $callMethod], $arguments);

            // if no response - throw 404 not found
            if (!$response) {
                throw new NotFoundException('Page not found: 404 error');
            }
        } catch (\Exception $e) {
            // check if exception is system-based throw
            if ($e instanceof TemplateException) {
                $response = $e->display();
            } else { // or hook exception to system based :)))
                if (App::$Debug) {
                    $msg = $e->getMessage() . $e->getTraceAsString();
                    $response = (new NativeException($msg))->display();
                } else {
                    $response = (new NativeException($e->getMessage()))->display();
                }
            }
        }

        // set full rendered content to response builder
        self::$Response->setContent($response);
        // echo full response to user via symfony http foundation
        self::$Response->send();
    }