request.js

/**
 * **Web-apps only**
 * 
 * Gives access to information about the current HTTP request. Accessed
 * via the global variable `request`.  This variable is only available when the script
 * has been invoked by a HTTP request.
 * @namespace
 */
request = {

	/**
	 * Provides access to the query-arguments of the request.
	 * The names of the fields of the returned object are those of the query-arguments.
	 * @type {Object}
	 */
	query: null,

	/**
	 * Provides access to the form-arguments of the request.
	 * The names of the fields of the returned object are those of the form-arguments.
	 * @type {Object}
	 */
	form: null,

	/**
	 * Provides access to the cookies in the request.
	 * The names of the fields of the returned object are those of the cookies.
	 * @type {Object}
	 */
	cookies: null,

	/**
	 * Provides access to the headers of the request.
	 * The names of the fields of the returned object are those of the headers.
	 * @type {Object}
	 */
	headers: null,

	/**
	 * The full requested URI.
	 * @type {String}
	 */
	uri: null,

	/**
	 * The request method ('get', 'post', 'head', etc)
	 * @type {String}
	 */
	method: null,

	/**
	 * Provides easy access to various components of the URI
	 * 
	 * @type {Object}
	 * @property {String} protocol 
	 * @property {String} host 
	 * @property {String} port 
	 * @property {String} path 
	 * @property {String} queryString 
	 */
	uriParts: null,

	/**
	 * The path of the currently executing script.
	 * @type {String}
	 */
	scriptPath: null,

	/**
	 * The path of the request (same as uriParts.path)
	 * @type {String}
	 */
	requestPath: null,

	/**
	 * The path from the directory of the file containing the currently executing script to the requested resource.
	 * For example, if the request is for `/dir1/dir2/dir3/resource1` and the `index.jss` file is in `/dir1` then `restPath=dir2/dir3/resource1`.
	 * This property is useful for implementing REST APIs.
	 * @type {String}
	 */
	restPath: null,

	/**
	 * Information about the local end-point.
	 * @type {Object}
	 * @property {String} ip IP address of the local end of the connection
	 * @property {String} port Port number of the local end of the connection
	 */
	localEndPoint: null,

	/**
	 * Information about the remote end-point.
	 * @type {Object}
	 * @property {String} ip IP address of the remote end of the connection
	 * @property {String} port Port number of the remote end of the connection
	 */
	remoteEndPoint: null

}