Section: Request object
|« Application entry points and jApp||^ Core workflow||Coordinator »|
A jRequest object for each type of request ¶
A jRequest object handles the processing of the input data in order to make it easily available to the framework and especially to the actions. It allows, among other things, to determine the name of the action to execute.
There are several types of jRequest objects, processing different input data. Indeed, we don't retrieve the input data for a HTML page (in the url (get) or encoded in the body of the HTTP request (post) ), the same way as we would do for a SOAP request (data in the body of the HTTP request in XML).
For each jRequest object, corresponds one or more authorized output format, then one or more authorized jResponse object.
The available jRequest object are:
- classic: for "normal" requests whose response type is any content (html, text, redirection ..)
- soap: for SOAP request, when you want implement some SOAP services. The response should be in SOAP format.
- xmlrpc: for the XMLRPC requests. The response must be in XMLRPC
- jsonrpc: for the JSONRPC requests. The response must be in jSONRPC
Other requests types are possible of course.
You'll have an entry points for each request type you want to support in your application.
During the action processing, the request object is accessible through the
request property of the
jCoordinator object. This object is
accessible through the
// To retrieve a request parameter $myfooValue = jApp::coord()->request->getParam('foo');
But in a controller, you have some method on the
jController class, to do
the same thing shortly:
$myfooValue = $this->param('foo');
Some other properties are available:
| ||to know the request type.|
| ||the path to the script in the url|
| ||the script name (so the name of the entry point)|
| ||The pathinfo part of the url|
| ||request parameters|
getIp(): to retrieve the IP of the client
getProtocol(): to know if it is HTTP or HTTPS
getPort(): to know the port (80, 443..)
getDomainName(): to retrieve the domain name
getServerURI(): to retrieve the url of the application
isAjax(): to know if the request is an ajax request or not.
headers(): to retrieve request headers.