org.helma.web
Class Request

java.lang.Object
  extended by org.mozilla.javascript.ScriptableObject
      extended by org.helma.web.Request
All Implemented Interfaces:
java.io.Serializable, org.mozilla.javascript.ConstProperties, org.mozilla.javascript.debug.DebuggableObject, org.mozilla.javascript.Scriptable

public class Request
extends org.mozilla.javascript.ScriptableObject

This class represents a HTTP Request. The current Request object can be accessed as global variable req.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.mozilla.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 
Fields inherited from interface org.mozilla.javascript.Scriptable
NOT_FOUND
 
Constructor Summary
Request()
           
Request(java.lang.Object request)
           
 
Method Summary
 java.lang.String getClassName()
           
protected  org.mozilla.javascript.Scriptable getJsArray(java.util.Enumeration en)
           
protected  org.mozilla.javascript.Scriptable getJsArray(java.lang.Object[] arr)
           
 java.lang.Object jsFunction_getCookies()
          Returns a JavaScript array containing the request's cookies as *servlet cookie|http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/http/Cookie.html* instances.
 java.lang.Object jsFunction_getDateHeader(java.lang.String name)
          Returns the value of the specified request header as Date object.
 java.lang.String jsFunction_getHeader(java.lang.String name)
          Returns the value of the specified request header as String.
 java.lang.Object jsFunction_getHeaders(java.lang.String name)
          Returns the value of the specified request header as JavaScript array of Strings.
 int jsFunction_getIntHeader(java.lang.String name)
          Returns the value of the specified request header as integer number.
 java.lang.String jsFunction_getParameter(java.lang.String name)
          Returns the value of a request parameter as a String, or null if the parameter does not exist.
 java.lang.Object jsFunction_getParameters(java.lang.String name)
          Returns an array of Strings containing all of the values the given request parameter has, or null if the parameter does not exist.
 java.lang.Object jsGet_cookies()
          A JavaScript object reflecting the request's HTTP cookies.
 java.lang.Object jsGet_data()
          A JavaScript object reflecting the HTTP parameters of this request.
 java.lang.Object jsGet_headers()
          A JavaScript object reflecting the headers of this request.
 java.lang.String jsGet_host()
          The host name of the server that received the request.
 java.lang.String jsGet_method()
          Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.
 java.lang.Object jsGet_params()
          A JavaScript object reflecting the HTTP parameters of this request.
 java.lang.String jsGet_path()
          The request's URI path, as passed in the first line of the HTTP request.
 java.lang.String jsGet_pathInfo()
          Returns any extra path information associated with the URL the client sent when it made this request.
 java.lang.String jsGet_pathTranslated()
          Returns any extra path information after the servlet name but before the query string, and translates it to a real path.
 int jsGet_port()
          The port number on which this request was received.
 java.lang.String jsGet_protocol()
          The name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.
 java.lang.String jsGet_queryString()
          The request's unparsed query string, or null if the request contains no query string.
 java.lang.String jsGet_scheme()
          The name of the scheme used to make this request, for example, http, https, or ftp.
 java.lang.Object jsGet_servletRequest()
          Get the servlet request as a wrapped java object
 
Methods inherited from class org.mozilla.javascript.ScriptableObject
associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Request

public Request()

Request

public Request(java.lang.Object request)
Method Detail

jsGet_servletRequest

public java.lang.Object jsGet_servletRequest()
Get the servlet request as a wrapped java object

Returns:
the servlet request as a wrapped java object

jsGet_host

public java.lang.String jsGet_host()
The host name of the server that received the request.

Returns:
the name of the server to which the request was sent

jsGet_port

public int jsGet_port()
The port number on which this request was received.

Returns:
an integer specifying the port number

jsGet_method

public java.lang.String jsGet_method()
Returns the name of the HTTP method with which this request was made, for example, GET, POST, or PUT.

Returns:
the HTTP method as String

jsGet_pathInfo

public java.lang.String jsGet_pathInfo()
Returns any extra path information associated with the URL the client sent when it made this request. The extra path information follows the servlet path but precedes the query string. This method returns null if there was no extra path information.

Returns:
the extra path info as String

jsGet_pathTranslated

public java.lang.String jsGet_pathTranslated()
Returns any extra path information after the servlet name but before the query string, and translates it to a real path. Same as the value of the CGI variable PATH_TRANSLATED. If the URL does not have any extra path information, this method returns null.

Returns:
the real path, or null if the URL does not have any extra path information

jsGet_protocol

public java.lang.String jsGet_protocol()
The name and version of the protocol the request uses in the form protocol/majorVersion.minorVersion, for example, HTTP/1.1.

Returns:
the name of the protocol used to make this request

jsGet_scheme

public java.lang.String jsGet_scheme()
The name of the scheme used to make this request, for example, http, https, or ftp.

Returns:
the name of the scheme used to make this request

jsGet_path

public java.lang.String jsGet_path()
The request's URI path, as passed in the first line of the HTTP request.

Returns:
the URI path of the request

jsGet_queryString

public java.lang.String jsGet_queryString()
The request's unparsed query string, or null if the request contains no query string.

Returns:
the query string or null if the URL contains no query string

jsFunction_getHeader

public java.lang.String jsFunction_getHeader(java.lang.String name)
Returns the value of the specified request header as String.

Parameters:
name - the header name
Returns:
the header value as String, or null if the header doesn't exist

jsFunction_getHeaders

public java.lang.Object jsFunction_getHeaders(java.lang.String name)
Returns the value of the specified request header as JavaScript array of Strings.

Parameters:
name - the header name
Returns:
the header value as Array of Strings

jsFunction_getDateHeader

public java.lang.Object jsFunction_getDateHeader(java.lang.String name)
Returns the value of the specified request header as Date object.

Parameters:
name - the header name
Returns:
the header value parsed as date, or null if the header doesn't exist

jsFunction_getIntHeader

public int jsFunction_getIntHeader(java.lang.String name)
Returns the value of the specified request header as integer number.

Parameters:
name - the header name
Returns:
the header value parsed as integer, or -1 if the header doesn't exist

jsGet_headers

public java.lang.Object jsGet_headers()
A JavaScript object reflecting the headers of this request.

Returns:
the request headers as JavaScript object

jsFunction_getParameter

public java.lang.String jsFunction_getParameter(java.lang.String name)
Returns the value of a request parameter as a String, or null if the parameter does not exist. You should only use this method when you are sure the parameter has only one value. If the parameter might have more than one value, use *getParameters(String)*. Request parameters are extra information sent with the request either in the query string or posted form data.

Parameters:
name - the parameter name
Returns:
the paremeter value

jsFunction_getParameters

public java.lang.Object jsFunction_getParameters(java.lang.String name)
Returns an array of Strings containing all of the values the given request parameter has, or null if the parameter does not exist.

Parameters:
name - the parameter name
Returns:
the parameter values

jsGet_params

public java.lang.Object jsGet_params()
A JavaScript object reflecting the HTTP parameters of this request. Note that both property names and values are always Strings. If there are multiple values for any parameter, all values but the first are discarded. You should only use this object when you are sure the parameter has only one value. If the parameter might have more than one value, use *getParameters(String)*. Request parameters are extra information sent with the request either in the query string or posted form data.

Returns:
the request parameters as JavaScript object

jsGet_data

public java.lang.Object jsGet_data()
A JavaScript object reflecting the HTTP parameters of this request. Note that both property names and values are always Strings. If there are multiple values for any parameter, all values but the first are discarded. You should only use this object when you are sure the parameter has only one value. If the parameter might have more than one value, use *getParameters(String)*. Request parameters are extra information sent with the request either in the query string or posted form data.

Returns:
the request parameters as JavaScript object

jsFunction_getCookies

public java.lang.Object jsFunction_getCookies()
Returns a JavaScript array containing the request's cookies as *servlet cookie|http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/http/Cookie.html* instances. This method should be used if there are multiple cookies with the same name, or if access to other cookie properties beyond its name and value are required. Otherwise, it is more convenient to use the *req.cookies|cookies* object.

Returns:
a JavaScript array with the request's cookie objects

jsGet_cookies

public java.lang.Object jsGet_cookies()
A JavaScript object reflecting the request's HTTP cookies. The object contains the cookie names as property names and the cookie values as property values. To access other cookie properties such as max-age, domain, or cookie path, and to access multiple cookies with the same name, use *req.getCookies()|getCookies()*, which returns a JavaScript arrays containing the raw *cookie objects|http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/http/Cookie.html*.

Returns:
a JavaScript object containing the request's HTTP cookies

getClassName

public java.lang.String getClassName()
Specified by:
getClassName in interface org.mozilla.javascript.Scriptable
Specified by:
getClassName in class org.mozilla.javascript.ScriptableObject

getJsArray

protected org.mozilla.javascript.Scriptable getJsArray(java.util.Enumeration en)

getJsArray

protected org.mozilla.javascript.Scriptable getJsArray(java.lang.Object[] arr)