From 6c374ad1891b85b65c52b8f37ec7e0b8ecca3bfe Mon Sep 17 00:00:00 2001 From: wei <> Date: Sat, 23 Sep 2006 06:36:11 +0000 Subject: change PageClass to ServiceParameter in TUrlMapping --- .../protected/pages/Configurations/UrlMapping.page | 18 +++++++--- framework/Web/THttpRequest.php | 5 +++ framework/Web/TUrlMapping.php | 39 +++++++++++----------- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/demos/quickstart/protected/pages/Configurations/UrlMapping.page b/demos/quickstart/protected/pages/Configurations/UrlMapping.page index 22cb866a..dde6854f 100644 --- a/demos/quickstart/protected/pages/Configurations/UrlMapping.page +++ b/demos/quickstart/protected/pages/Configurations/UrlMapping.page @@ -20,13 +20,21 @@ file and before any services.
The mapping format is as follows.
The PageClass set the name of class that the matched URL will -be requested.
The Pattern and Parameters attribute +The ServiceParameter and ServiceID + (the default ID is 'page') set the service parameter and service ID respectively. + The service parameter for the TPageService service is the + Page class name, e.g., for an URL "index.php?page=Home", "page" is the service ID and the service + parameter is "Home". Other services may use the service parameter and ID differently. +See Services for further details. +
+ +
+The Pattern and Parameters attribute
values are regular expression patterns that
determine the mapping criteria. The Pattern property takes
a regular expression with parameter names enclosed between a left brace '{'
@@ -34,13 +42,13 @@ and a right brace '}'. The pattens for each parameter can be set
using Parametersattribute collection.
For example,
*
- *
- *
- *
+ *
+ *
+ *
*
*
*
@@ -189,10 +189,10 @@ class TUrlMapping extends THttpRequest
{
$request = $this->getRequest();
$id = $pattern->getServiceID();
- $page = $pattern->getPageClass();
+ $param = $pattern->getServiceParameter();
$request->setServiceID($id);
- $request->setServiceParameter($page);
- $request->add($id,$page);
+ $request->setServiceParameter($param);
+ $request->add($id,$param);
}
}
@@ -227,9 +227,10 @@ class TUrlMapping extends THttpRequest
* The parameter values are available through the standard Request
* object. For example, $this->Request['year'].
*
- * The {@link setPageClass PageClass} and {@link setServiceID ServiceID}
- * (the default ID is 'page') set the class and the service that will
- * handle the matching URL.
+ * The {@link setServiceParameter ServiceParameter} and {@link setServiceID ServiceID}
+ * (the default ID is 'page') set the service parameter and service id respectively.
+ * The service parameter for the TPageService is the Page class name, other service
+ * may use the service parameter differently.
*
* For more complicated mappings, the body of the <url>
* can be used to specify the mapping pattern.
@@ -242,9 +243,9 @@ class TUrlMapping extends THttpRequest
class TUrlMappingPattern extends TComponent
{
/**
- * @var string page class name.
+ * @var string service parameter such as Page class name.
*/
- private $_pageClass;
+ private $_serviceParameter;
/**
* @var string service ID, default is 'page'.
*/
@@ -277,10 +278,10 @@ class TUrlMappingPattern extends TComponent
$body = trim($config->getValue());
if(strlen($body)>0)
$this->setPattern($body);
- if(is_null($this->_pageClass))
+ if(is_null($this->_serviceParameter))
{
throw new TConfigurationException(
- 'dispatcher_url_page_class_missing', $this->getPattern());
+ 'dispatcher_url_service_parameter_missing', $this->getPattern());
}
$this->initializePattern();
}
@@ -310,19 +311,19 @@ class TUrlMappingPattern extends TComponent
}
/**
- * @param string name of the page class to handle the request.
+ * @param string service parameter, such as page class name.
*/
- public function setPageClass($value)
+ public function setServiceParameter($value)
{
- $this->_pageClass=$value;
+ $this->_serviceParameter=$value;
}
/**
- * @return string page class name.
+ * @return string service parameter, such as page class name.
*/
- public function getPageClass()
+ public function getServiceParameter()
{
- return $this->_pageClass;
+ return $this->_serviceParameter;
}
/**
--
cgit v1.2.3