Class CWebApplication
CWebApplication extends CApplication by providing functionalities specific to Web requests.
CWebApplication manages the controllers in MVC pattern, and provides the following additional core application components:- urlManager: provides URL parsing and constructing functionality;
- request: encapsulates the Web request information;
- session: provides the session-related functionalities;
- assetManager: manages the publishing of private asset files.
- user: represents the user session information.
- themeManager: manages themes.
- authManager: manages role-based access control (RBAC).
- clientScript: manages client scripts (javascripts and CSS).
- widgetFactory: creates widgets and supports widget skinning.
User requests are resolved as controller-action pairs and additional
parameters. CWebApplication creates the requested controller instance and let it
to handle the actual user request. If the user does not specify controller ID,
it will assume CWebApplication::$defaultController
is requested (which defaults to
'site').
Controller class files must reside under the directory getControllerPath controllerPath (defaults to 'protected/controllers'). The file name and the class name must be the same as the controller ID with the first letter in upper case and appended with 'Controller'. For example, the controller 'article' is defined by the class 'ArticleController' which is in the file 'protected/controllers/ArticleController.php'.
- CComponent
- CModule
- CApplication
- CWebApplication
Direct known subclasses
X2WebApplicationCopyright: 2008-2013 Yii Software LLC
License: http://www.yiiframework.com/license/
Author: Qiang Xue <qiang.xue@gmail.com>
Since: 1.0
Located at x2engine/framework/web/CWebApplication.php
public
|
#
processRequest( )
Processes the current request. It first resolves the request into controller and action, and then creates the controller to perform the action. |
protected
|
#
registerCoreComponents( )
Registers the core application components. This method overrides the parent implementation by registering additional core components. |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
#
getViewRenderer( )
Returns the view renderer. If this component is registered and enabled, the
default view rendering logic defined in |
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
|
|
public
array
|
#
createController( string $route,
Creates a controller instance based on a route. The route should contain the controller ID and the action ID. It may also contain additional GET variables. All these must be concatenated together with slashes. |
protected
string
|
|
public
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
string
|
|
public
|
|
public
boolean
|
#
beforeControllerAction(
The pre-filter for controller actions. This method is invoked before the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done before all controller actions. |
public
|
#
afterControllerAction(
The post-filter for controller actions. This method is invoked after the currently requested controller action and all its filters are executed. You may override this method with logic that needs to be done after all controller actions. |
public
|
#
findModule( string $id )
Do not call this method. This method is used internally to search for a module by its ID. |
protected
|
public
string
|
$defaultController | 'site' |
|
public
mixed
|
$layout | 'main' |
#
the application-wide layout. Defaults to 'main' (relative to getLayoutPath layoutPath). If this is false, then no layout will be used. |
public
array
|
$controllerMap | array() |
#
mapping from controller ID to controller configurations. Each name-value pair specifies the configuration for a single controller. A controller configuration can be either a string or an array. If the former, the string should be the class name or YiiBase::getPathOfAlias class path alias of the controller. If the latter, the array must contain a 'class' element which specifies the controller's class name or YiiBase::getPathOfAlias class path alias. The rest name-value pairs in the array are used to initialize the corresponding controller properties. For example, array( 'post'=>array( 'class'=>'path.to.PostController', 'pageTitle'=>'something new', ), 'user'=>'path.to.UserController', ) Note, when processing an incoming request, the controller map will first be checked to see if the request can be handled by one of the controllers in the map. If not, a controller will be searched for under the getControllerPath default controller path. |
public
array
|
$catchAllRequest |
|
#
the configuration specifying a controller which should handle all user requests. This is mainly used when the application is in maintenance mode and we should use a controller to handle all incoming requests. The configuration specifies the controller route (the first element) and GET parameters (the rest name-value pairs). For example, array( 'offline/notice', 'param1'=>'value1', 'param2'=>'value2', ) Defaults to null, meaning catch-all is not effective. |
public
string
|
$controllerNamespace |
|
#
Namespace that should be used when loading controllers. Default is to use global namespace. |
$charset,
$localeClass,
$name,
$sourceLanguage
|
$behaviors,
$preload
|
public
|
$authManager |
#
The authorization manager component. |
public
|
$assetManager |
#
The asset manager component. |
public
|
$session |
#
The session component. |
public
|
$user |
#
The user session information. |
public
|
$viewRenderer |
#
The view renderer. |
public
|
$clientScript |
#
The client script manager. |
public
|
$widgetFactory |
#
The widget factory. |
public
|
$themeManager |
#
The theme manager. |
public
|
$theme |
#
The theme used currently. Null if no theme is being used. |
public
|
$controller |
#
The currently active controller. |
public
string
|
$controllerPath |
#
The directory that contains the controller classes. Defaults to 'protected/controllers'. |
public
string
|
$viewPath |
#
The root directory of view files. Defaults to 'protected/views'. |
public
string
|
$systemViewPath |
#
The root directory of system view files. Defaults to 'protected/views/system'. |
public
string
|
$layoutPath |
#
The root directory of layout files. Defaults to 'protected/views/layouts'. |
$basePath,
$baseUrl,
$cache,
$coreMessages,
$dateFormatter,
$db,
$errorHandler,
$extensionPath,
$homeUrl,
$id,
$language,
$locale,
$localeDataPath,
$messages,
$numberFormatter,
$request,
$runtimePath,
$securityManager,
$statePersister,
$timeZone,
$urlManager
|
$aliases,
$components,
$import,
$modulePath,
$modules,
$params,
$parentModule
|