TUrlMapping Class
The TUrlMapping module allows aributary URL path to be mapped to a particular service and page class. This module must be configured before a service is initialized, thus this module should be configured globally in the <tt>application.xml</tt> file and before any services.
- <module id="friendly-url" class="System.Web.TUrlMapping">
- <url ServiceParameter="Posts.ViewPost" pattern="post/{id}/?" parameters.id="\d+" />
- <url ServiceParameter="Posts.ListPost" pattern="archive/{time}/?" parameters.time="\d{6}" />
- <url ServiceParameter="Posts.ListPost" pattern="category/{cat}/?" parameters.cat="\d+" />
- </module>
- <module id="request" class="THttpRequest" UrlManager="friendly-url" />
See TUrlMappingPattern for details regarding the mapping patterns. Similar to other modules, the <tt><url /></tt> configuration class can be customised using the <tt>class</tt> property.
The URL mapping are evaluated in order, only the first mapping that matches the URL will be used. Cascaded mapping can be achieved by placing the URL mappings in particular order. For example, placing the most specific mappings first.
The mapping can be load from an external file by specifying a configuration file using the ConfigFile property.
Since TUrlMapping is a URL manager extending from TUrlManager, you may override TUrlManager::constructUrl to support your pattern-based URL scheme.
Located in /Web/TUrlMapping.php (line 51)
TComponent | --TApplicationComponent | --TModule | --TUrlManager | --TUrlMapping
Initializes this module.
This method is required by the IModule interface.
Initialize the module from configuration file.
Load and configure each url mapping pattern.
Parses the request URL and returns an array of input parameters.
This method overrides the parent implementation. The input parameters do not include GET and POST variables. This method uses the request URL path to find the first matching pattern. If found the matched pattern parameters are used to return as the input parameters.
Inherited From TUrlManager
TUrlManager::constructUrl()
TUrlManager::parseUrl()
Inherited From TModule
TModule::getID()
TModule::init()
TModule::setID()
Inherited From TApplicationComponent
TApplicationComponent::getApplication()
TApplicationComponent::getRequest()
TApplicationComponent::getResponse()
TApplicationComponent::getService()
TApplicationComponent::getSession()
TApplicationComponent::getUser()
TApplicationComponent::publishAsset()
TApplicationComponent::publishFilePath()
Inherited From TComponent
TComponent::addParsedObject()
TComponent::attachEventHandler()
TComponent::canGetProperty()
TComponent::canSetProperty()
TComponent::createdOnTemplate()
TComponent::detachEventHandler()
TComponent::evaluateExpression()
TComponent::evaluateStatements()
TComponent::getEventHandlers()
TComponent::getSubProperty()
TComponent::hasEvent()
TComponent::hasEventHandler()
TComponent::hasProperty()
TComponent::raiseEvent()
TComponent::setSubProperty()
TComponent::__get()
TComponent::__set()
Documentation generated on Sun, 14 Jan 2007 21:44:56 -0500 by phpDocumentor 1.3.0RC4