ZMObject
└─ZMRequest
public class ZMRequest
extends ZMObject
| Constant Summary | |
|---|---|
| final static str | Default paramter name containing the request id. |
| final static str | Name of the session token form field and also the name in the session. |
| Fields inherited from org.zenmagick.core\ZMObject | |
|---|---|
| properties_ | |
| Method Summary | |
|---|---|
| void | __construct(array parameter) Create new instance. |
| string | absoluteURL(string url, boolean full, boolean secure) Convert a given relative URL into an absolute one. |
| void | Close session if required. |
| string | Get the URL context for this request. |
| ZMController | Get the controller for this request. |
| string | getFollowUpUrl(boolean clear) Check if a follow up url exists that should be loaded (after a login). |
| string | Get the hostname for this request. |
| string | Get the request method. |
| mixed | getParameter(string name, mixed default, boolean sanitize) Generic access method for request parameter. |
| array | getParameterMap(boolean sanitize) Get the complete parameter map. |
| string | getPort() Get the port for this request. |
| string | Get the protocol used. |
| string | Get the full query string. |
| string | Get the request id. |
| string | Get the name of the request parameter that contains the request id. |
| array | Get a list of ZMSeoRewriter instances for SEO urls. |
| ZMSession | Get the current session. |
| string | Get the template path. |
| ZMToolbox | Get the toolbox for this request. |
| string | getUri() Get the uri for this request. |
| mixed | getUser() Get the user (if any) for authentication. |
| string | Get the web path. |
| static void | instance() Get instance. |
| boolean | isSecure() Checks if the current request is secure or note. |
| void | redirect(string url, int status) Redirect to the given url. |
| void | Save this request as follow up URL. |
| void | Decode a (potentially) rewritten request. |
| void | setController(ZMController controller) Set the current controller. |
| void | setMethod(string method) Set the request method. |
| mixed | setParameter(string name, mixed value) Allow programmatic manipulation of request parameters. |
| void | setParameterMap(array map) Set the parameter map. |
| void | setRequestId(string requestId) Set the request id. |
| void | setSession(ZMSession session) Set the current session instance. |
| string | url(string requestId, string params, boolean secure) Create a URL. |
| boolean | Validate session token. |
| Methods inherited from org.zenmagick.core\ZMObject | |
|---|---|
| __construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton | |
public final static str DEFAULT_REQUEST_ID = 'rid'
Default paramter name containing the request id.
Will be used if the 'zenmagick.mvc.request.idName' is not set.
public final static str SESSION_TOKEN_NAME = 'stoken'
Name of the session token form field and also the name in the session.
public void __construct(array parameter)
Create new instance.
null, $_GET and $_POST will be used.public string absoluteURL(string url, boolean full, boolean secure)
Convert a given relative URL into an absolute one.
false.false.public void closeSession()
Close session if required.
public string getContext()
Get the URL context for this request.
public ZMController getController()
Get the controller for this request.
In case the controller is not explicitely set, the method will use the url mapper
(ZMUrlManager::instance()->findController()) to determine a controller. This will then
be either a configured controller or the default controller.
public string getFollowUpUrl(boolean clear)
Check if a follow up url exists that should be loaded (after a login).
true to clear.null.public string getHostname()
Get the hostname for this request.
public string getMethod()
Get the request method.
public mixed getParameter(string name, mixed default, boolean sanitize)
Generic access method for request parameter.
This method is evaluating both GET and POST parameter.
There is a special case for when a parameter is not found, but _[name] is found. In this
case false is returned. This allows to handle checkboxes same as any other form element
by adding a hidden field _[name] with the original value.
null is used).true, sanitze value; default is true.null.public array getParameterMap(boolean sanitize)
Get the complete parameter map.
true, sanitze value; default is true.public string getPort()
Get the port for this request.
public string getProtocol()
Get the protocol used.
public string getQueryString()
Get the full query string.
public string getRequestId()
Get the request id.
The request id is the main criteria for selecting the controller and view to process this request.
public string getRequestIdKey()
Get the name of the request parameter that contains the request id.
public array getSeoRewriter()
Get a list of ZMSeoRewriter instances for SEO urls.
The list is build based on the classes registered via the setting 'zenmagick.mvc.request.seoRewriter'.
ZMSeoRewriter instances.public ZMSession getSession()
Get the current session.
public string getTemplatePath()
Get the template path.
public ZMToolbox getToolbox()
Get the toolbox for this request.
public string getUri()
Get the uri for this request.
public mixed getUser()
Get the user (if any) for authentication.
Creation of the user object is delegated to the configured ZMUserFactory instance.
The factory may be configured as bean defintion via the setting 'zenmagick.mvc.session.userFactory'.
null.public string getWebPath()
Get the web path.
public static void instance()
Get instance.
A final straw to get the shared request instance if nothing else is available.
public boolean isSecure()
Checks if the current request is secure or note.
true if the current request is secure; eg. SSL, false if not.public void redirect(string url, int status)
Redirect to the given url.
public void saveFollowUpUrl()
Save this request as follow up URL.
Typically this happends when a request is received without valid authority. The saved URL will be forwarded to, once permissions is gained (user logged in).
public void seoDecode()
Decode a (potentially) rewritten request.
public void setController(ZMController controller)
Set the current controller.
public void setMethod(string method)
Set the request method.
public mixed setParameter(string name, mixed value)
Allow programmatic manipulation of request parameters.
null.public void setParameterMap(array map)
Set the parameter map.
public void setRequestId(string requestId)
Set the request id.
public void setSession(ZMSession session)
Set the current session instance.
public string url(string requestId, string params, boolean secure)
Create a URL.
Mother of all URL related methods.
If the requestId parameter is null, the current requestId will be
used. The provided parameter(s) will be merged into the current query string.
If the params parameter is null, all parameters of the
current request will be added.
This default implementation relies on at least a single (default) SEO rewriter being configured.
null to use the value of the current request.null add all current parameters; default is an empty string for none.false.public boolean validateSessionToken()
Validate session token.
true in case the session token is valid.
A request wrapper.
NOTE: For the time of transition between static and instance usage of request methods this will have a temp. name of
ZMRequest.