ZMObject
|
+--ZMUrlMapper
public class ZMUrlMapper
extends ZMObject
| Fields inherited from org.zenmagick.ZMObject | |
|---|---|
| properties_ | |
| Constructor Summary | |
|---|---|
Create new instance. |
|
| Method Summary | |
|---|---|
| ZMController | findController(string page) Find the controller (class) mapped to the given page. |
| array | findMapping(string page, string viewId, mixed parameter) Find a URL mapping for the given controller (and viewId). |
| string | getViewDefinition(string page, string viewId, mixed parameter) Get the view definition string for the given controller (and viewId). |
| static void | instance() Get instance. |
| void | setMappingInfo(string page, array viewInfo) Set a mapping for the given page $page. |
| Methods inherited from org.zenmagick.ZMObject | |
|---|---|
| attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton | |
public ZMUrlMapper()
Create new instance. /
public ZMController findController(string page)
Find the controller (class) mapped to the given page.
Unless explicitely configured, the controller class name will be build from the given page name.
If no page specific controller is found, an instance of
ZMSettings::get('defaultControllerClass') will be returned.
public array findMapping(string page, string viewId, mixed parameter)
Find a URL mapping for the given controller (and viewId).
null to use the controller.null.null.public string getViewDefinition(string page, string viewId, mixed parameter)
Get the view definition string for the given controller (and viewId).
null to use the controller.null.public static void instance()
Get instance. /
public void setMappingInfo(string page, array viewInfo)
Set a mapping for the given page $page.
Supported $viewInfo keys (viewDefinition, controllerDefinition and formClass
allow either a bean definitions or a plain class name):
$page.$page.
ZMView implementation class to use; default is PageView.null
to use $page to build a classname (see ZMLoader::makeClassname(string) for details).null for none.null for none.In the case of $page being null, at least viewId is required.
null may be used to lookup shared mappings.array().
Handle URL mappings.
The URL mappings connect the requested page (value of ZM_PAGE_KEY) with a view (template) and optionally a controller to handle the request.
The default behaviour for controller is to build the controller class using the ZM_PAGE_KEY value.
Furthermore, depending on the processing of a request in a controller, different views may be returned. This is archived by mapping the actual template name not to a request (ZM_PAGE_KEY value) or controller class, but to a logical key that is used by the controller to lookup the actual view template.
Finally, there are optional settings for form validation that are not used (yet).