Quick links: Content - sections - sub sections
EN FR

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.

API

During the action processing, the request object is accessible through the request property of the jCoordinator object. This object is accessible through the jApp object.


// 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:

type to know the request type.
url_script_path the path to the script in the url
url_script_name the script name (so the name of the entry point)
url_path_info The pathinfo part of the url
params request parameters

Some methods:

  • 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 <protocol><domain>[:<port>]
  • isAjax(): to know if the request is an ajax request or not.
  • header() and headers(): to retrieve request headers.