/** * This method dispatch the current request * * @param __IRequest &$request The request to process to * @param __IResponse &$response The instance to set the response to * */ public function processRequest(__IRequest &$request, __IResponse &$response) { //resolve action identity from request $action_identity = $request->getActionIdentity(); //resolve the action controller associated to the given action identity $controller_definition = __ActionControllerResolver::getInstance()->getActionControllerDefinition($action_identity->getControllerCode()); //check if action controller is requestable if ($controller_definition instanceof __ActionControllerDefinition && $controller_definition->isRequestable()) { __HistoryManager::getInstance()->addRequest($request); //last, execute the action controller __ActionDispatcher::getInstance()->dispatch($action_identity); } else { throw __ExceptionFactory::getInstance()->createException('ERR_ACTION_NON_REQUESTABLE'); } }
/** * This method dispatch the current request * */ public function processRequest(__IRequest &$request, __IResponse &$response) { $action_identity = $request->getActionIdentity(); $controller_code = $action_identity->getControllerCode(); //in case we haven't define any controller, will use the commandline controller from lion admin: if (empty($controller_code)) { //switch to lion admin area: __ContextManager::getInstance()->createContext("LION_ADMIN_AREA", ADMIN_DIR); __ContextManager::getInstance()->switchContext("LION_ADMIN_AREA"); //execute the commandline controller: $action_identity->setControllerCode('commandline'); } $controller_definition = __ActionControllerResolver::getInstance()->getActionControllerDefinition($action_identity->getControllerCode()); //check if action controller is requestable if ($controller_definition instanceof __ActionControllerDefinition && $controller_definition->isRequestable()) { __ActionDispatcher::getInstance()->dispatch($action_identity); } else { throw __ExceptionFactory::getInstance()->createException('ERR_ACTION_NON_REQUESTABLE'); } }