Request (req) - Axiom

The request object provides methods and properties for the current client request. It is global, which means you can access this object from any script. It is instantiated as "req".


Contents

req.action

Description

req.action

(String) - The current action that has been executed via an http request.

Also See...


req.cookies

Description

req.cookies

(Object) - contains the cookies in the request. Cookies are stored as key/value pairs.

Examples

var user_cookie = req.cookies.usercookie;

If the browser sent a cookie named 'usercookie' with the request, then calling req.cookies.usercookie will give you that value.

Also See...


req.data

Description

req.data

(Object) - Contains the request data, and form data (if any was submitted).

Notes The following data always comes in with each request:

  • Remote Host (req.data.http_remotehost) - The hostname that made the request.
  • Host Host (req.data.http_host) - The hostname that the Axiom Stack Server was requested with.
  • Browser (req.data.http_browser) - The User Agent ID of the browser making the request.
  • Language (req.data.http_language) - Locale of the browser making the request.
  • Referrer (req.data.http_referer) - Referring page- where the browser last visited.

Form data can also be accessed, by using req.data.inputname to retrieve values.

Examples

var first_name = req.data.firstname;

If a text input with the name attribute set to "firstname" was submitted, calling req.data.firstname will give you that value.

Also See...

req.method

Description

req.method

(String) - The current method used to make the request.

Also See...


req.path

Description

req.path

(String) - The Path to the Axiom Object being requested, followed by the action used for the request.

Also See...


req.postBody

Description

req.postBody

(String, Object, or XML) - The body of an http post request. It is a String, Object, or XML, depending on the Content-Type of the request (Object if it is text/json, XML if it is text/xml, String for anything else).

Also See...


req.postParams

Description

req.postParams

(Object) - Properties consist of name/value pairs submitted in an http get.

Also See...


req.queryParams

Description

req.queryParams

(Object) - Properties consist of name/value pairs submitted in an http get.

Also See...


req.runtime

Description

req.runtime

(Number) - The amount of time (in milliseconds) that the current request has been executing.

Also See...


req.servletRequest

Description

servletRequest

(Object) - The underlying Jetty Request Object.

Also See...


req.get()

Description

req.get(param)

Returns request parameter as a String.

Parameters

  • param (String) - Parameter name whose value is being retrieved.

Returns

(String) - Request Parameter.

Also See...


req.getAction()

Description

req.getAction()

Returns a String that defines the current action that has been executed via an http request.

Returns

(String) - String that defines the current action that has been executed via an http request.

Also See...


req.getCookies()

Description

req.getCookies()

Returns an Object that contains the cookies data that came in the request. See req.cookies.

Returns

(Object) - Object that contains the cookies in the request from the browser, as name/value pairs.

Also See...


req.getData()

Description

req.getData()

Returns an Object that contains the request data, and form data (if any was submitted). See req.data.

Returns

(Object) - Object that contains the request data, and form data (if any was submitted).

Also See...


req.getHeader()

Description

req.getHeader(name)

Returns the header value (as a string) in the request object for the given input name.

Parameters

  • name (String) - The name of the header value to be retrieved.

Returns

(String) - String that corresponds to the header value for the input name, or null if it doesn't exist in the header.


req.getHeaders()

Description

req.getHeaders(name)

Returns the header values (as an array of strings) in the request object for the given input name.

Parameters

  • name (String) - The name of the header value to be retrieved.

Returns

(Array) - An Array of strings that corresponds to the header values for the input name, or null if it doesn't exist in the header.


req.getMethod()

Description

req.getMethod()

Returns a String that defines the current method used to make the request.

Returns

(String) - String that defines the current method used to make the request.

Also See...


req.getPath()

Description

req.getPath()

Returns the Path to the Axiom Object being requested, followed by the action used for the request.

Returns

(String) - Path to the Axiom Object being requested, followed by the action used for the request.

Also See...


req.getPostBody()

Description

req.getPostBody()

Returns the body of an http post request.

Returns

(String, Object, or XML) - The body of an http post request. It will be returned as a String, Object, or XML, depending on the Content-Type of the request (Object if it is text/json, XML if it is text/xml, String for anything else).

Also See...


req.getPostParams()

Description

req.getPostParams()

Returns an Object whose properties consist of name/value pairs submitted in an http post.

Returns

(Object) - Object whose properties consist of name/value pairs submitted in an http post.

Also See...


req.getQueryParams()

Description

req.getQueryParams()

Returns an Object whose properties consist of name/value pairs submitted in an http get.

Returns

(Object) - Object whose properties consist of name/value pairs submitted in an http get.

Also See...


req.getRuntime()

Description

req.getRuntime()

Returns the amount of time the current request has been executing in milliseconds.

Returns

(Object) - The duration of the request in milliseconds.

Also See...


req.getServletRequest()

Description

req.getServletRequest()

Returns the underlying Jetty Request Object.

Returns

(Object) - The underlying Jetty Request Object.

Also See...


req.isGet()

Description

req.isGet()

Returns whether or not the request method is an http get.

Returns

(Boolean) - True if the request method is an http get.


req.isPost()

Description

req.isPost()

Returns whether or not the request method is an http post.

Returns

(Boolean) - True if the request method is an http post.