## helma.framework
Class RequestTrans

    java.lang.Object
      helma.framework.RequestTrans

All Implemented Interfaces:
  java.io.Serializable

    public class RequestTrans

extends java.lang.Object
implements java.io.Serializable

A Transmitter for a request from the servlet client. Objects of this class are directly exposed to JavaScript as global property req.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` `DELETE`
`static java.lang.String` `EXTERNAL`
`static java.lang.String` `GET`
`static java.lang.String` `HEAD`
`static java.lang.String` `INTERNAL`
`static java.lang.String` `OPTIONS`
`static java.lang.String` `POST`
`static java.lang.String` `PUT`
`static java.lang.String` `TRACE`
`static java.lang.String` `XMLRPC`

Constructor Summary
`RequestTrans(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String path)` Create a new request transmitter with the given data map.
`RequestTrans(java.lang.String method, java.lang.String path)` Create a new Request transmitter with an empty data map.

Method Summary
`void` `addPostParam(java.lang.String name, java.lang.Object value)` Add a post parameter to the request
`boolean` `checkXmlRpc()` Return true if we should try to handle this as XML-RPC request.
`boolean` `equals(java.lang.Object what)` A request is considered equal to another one if it has the same method, path, session, request data, and conditional get data.
`java.lang.Object` `get(java.lang.String name)` Get a value from the requests map by key.
`java.lang.String` `getAction()` Get the request's action.
`java.lang.Object` `getActionHandler()` Get the request's action handler.
`java.util.Map` `getCookies()`
`long` `getDateHeader(java.lang.String name)` Proxy to HttpServletRequest.getDateHeader(), fails silently by returning -1.
`java.util.Set` `getETags()`
`java.lang.String` `getHeader(java.lang.String name)` Proxy to HttpServletRequest.getHeader().
`java.lang.String[]` `getHeaders(java.lang.String name)` Proxy to HttpServletRequest.getHeaders(), returns header values as string array.
`long` `getIfModifiedSince()`
`int` `getIntHeader(java.lang.String name)` Proxy to HttpServletRequest.getIntHeader(), fails silently by returning -1.
`java.lang.String` `getMethod()` Return the method of the request.
`java.util.Map` `getParams()`
`java.lang.String` `getPassword()`
`java.lang.String` `getPath()` Get the request's path
`java.util.Map` `getPostParams()`
`java.util.Map` `getQueryParams()`
`java.util.Map` `getRequestData()` Get the data map for this request transmitter.
`javax.servlet.http.HttpServletRequest` `getServletRequest()` Returns the Servlet request represented by this RequestTrans instance.
`javax.servlet.http.HttpServletResponse` `getServletResponse()` Returns the Servlet response for this request.
`java.lang.String` `getSession()` Get the request's session id
`long` `getStartTime()` Get the time the request was created.
`java.lang.String` `getUri()` Get the request's path
`java.lang.String` `getUsername()`
`boolean` `hasETag(java.lang.String etag)`
`int` `hashCode()` The hash code is computed from the session id if available.
`boolean` `isGet()` Return true if this object represents a HTTP GET Request.
`boolean` `isPost()` Return true if this object represents a HTTP GET Request.
`boolean` `isXmlRpc()` Return true if this request is in fact handled as XML-RPC request.
`void` `set(java.lang.String name, java.lang.Object value)` Set a parameter value in this request transmitter.
`void` `setAction(java.lang.String action)` Set the request's action.
`void` `setActionHandler(java.lang.Object handler)` Set the request's action handler.
`void` `setCookie(java.lang.String name, javax.servlet.http.Cookie cookie)` Set a cookie
`void` `setETags(java.lang.String etagHeader)`
`void` `setIfModifiedSince(long since)`
`void` `setMethod(java.lang.String method)` Set the method of this request.
`void` `setParameters(java.util.Map parameters, boolean isPost)` set the request parameters
`void` `setSession(java.lang.String session)` Set the request's session id

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### GET

    public static final java.lang.String GET

See Also:
  Constant Field Values

### POST

    public static final java.lang.String POST

See Also:
  Constant Field Values

### DELETE

    public static final java.lang.String DELETE

See Also:
  Constant Field Values

### HEAD

    public static final java.lang.String HEAD

See Also:
  Constant Field Values

### OPTIONS

    public static final java.lang.String OPTIONS

See Also:
  Constant Field Values

### PUT

    public static final java.lang.String PUT

See Also:
  Constant Field Values

### TRACE

    public static final java.lang.String TRACE

See Also:
  Constant Field Values

### XMLRPC

    public static final java.lang.String XMLRPC

See Also:
  Constant Field Values

### EXTERNAL

    public static final java.lang.String EXTERNAL

See Also:
  Constant Field Values

### INTERNAL

    public static final java.lang.String INTERNAL

See Also:
  Constant Field Values

Constructor Detail

### RequestTrans

    public RequestTrans(java.lang.String method,
                        java.lang.String path)

  Create a new Request transmitter with an empty data map.

### RequestTrans

    public RequestTrans(javax.servlet.http.HttpServletRequest request,
                        javax.servlet.http.HttpServletResponse response,
                        java.lang.String path)

  Create a new request transmitter with the given data map.

Method Detail

### checkXmlRpc

    public boolean checkXmlRpc()

  Return true if we should try to handle this as XML-RPC request.

  Returns:
    true if this might be an XML-RPC request.

### isXmlRpc

    public boolean isXmlRpc()

  Return true if this request is in fact handled as XML-RPC request. This implies that `checkXmlRpc()` returns true and a matching XML-RPC action was found.

  Returns:
    true if this request is handled as XML-RPC request.

### setCookie

    public void setCookie(java.lang.String name,
                          javax.servlet.http.Cookie cookie)

  Set a cookie

  Parameters:
    `name` - the cookie name
    `cookie` - the cookie

### getCookies

    public java.util.Map getCookies()

  Returns:
    a map containing the cookies sent with this request

### getParams

    public java.util.Map getParams()

  Returns:
    the combined query and post parameters for this request

### getQueryParams

    public java.util.Map getQueryParams()

  Returns:
    get the query parameters for this request

### getPostParams

    public java.util.Map getPostParams()

  Returns:
    get the post parameters for this request

### setParameters

    public void setParameters(java.util.Map parameters,
                              boolean isPost)

  set the request parameters

### addPostParam

    public void addPostParam(java.lang.String name,
                             java.lang.Object value)

  Add a post parameter to the request

  Parameters:
    `name` - the parameter name
    `value` - the parameter value

### set

    public void set(java.lang.String name,
                    java.lang.Object value)

  Set a parameter value in this request transmitter. This parses foo[bar][baz] as nested objects/maps.

### get

    public java.lang.Object get(java.lang.String name)

  Get a value from the requests map by key.

### getRequestData

    public java.util.Map getRequestData()

  Get the data map for this request transmitter.

### getServletRequest

    public javax.servlet.http.HttpServletRequest getServletRequest()

  Returns the Servlet request represented by this RequestTrans instance. Returns null for internal and XML-RPC requests.

### getHeader

    public java.lang.String getHeader(java.lang.String name)

  Proxy to HttpServletRequest.getHeader().

  Parameters:
    `name` - the header name
  Returns:
    the header value, or null

### getHeaders

    public java.lang.String[] getHeaders(java.lang.String name)

  Proxy to HttpServletRequest.getHeaders(), returns header values as string array.

  Parameters:
    `name` - the header name
  Returns:
    the header values as string array

### getIntHeader

    public int getIntHeader(java.lang.String name)

  Proxy to HttpServletRequest.getIntHeader(), fails silently by returning -1.

  Parameters:
    `name` - the header name
  Returns:
    the header parsed as integer or -1

### getDateHeader

    public long getDateHeader(java.lang.String name)

  Proxy to HttpServletRequest.getDateHeader(), fails silently by returning -1.

  Parameters:
    `name` - the header name
  Returns:
    the date in milliseconds, or -1

### getServletResponse

    public javax.servlet.http.HttpServletResponse getServletResponse()

  Returns the Servlet response for this request. Returns null for internal and XML-RPC requests.

### hashCode

    public int hashCode()

  The hash code is computed from the session id if available. This is used to detect multiple identic requests.

  Overrides:
    `hashCode` in class `java.lang.Object`

### equals

    public boolean equals(java.lang.Object what)

  A request is considered equal to another one if it has the same method, path, session, request data, and conditional get data. This is used to evaluate multiple simultanous identical requests only once.

  Overrides:
    `equals` in class `java.lang.Object`

### getMethod

    public java.lang.String getMethod()

  Return the method of the request. This may either be a HTTP method or one of the Helma pseudo methods defined in this class.

### setMethod

    public void setMethod(java.lang.String method)

  Set the method of this request.

  Parameters:
    `method` - the method.

### isGet

    public boolean isGet()

  Return true if this object represents a HTTP GET Request.

### isPost

    public boolean isPost()

  Return true if this object represents a HTTP GET Request.

### getSession

    public java.lang.String getSession()

  Get the request's session id

### setSession

    public void setSession(java.lang.String session)

  Set the request's session id

### getPath

    public java.lang.String getPath()

  Get the request's path

### getUri

    public java.lang.String getUri()

  Get the request's path

### getAction

    public java.lang.String getAction()

  Get the request's action.

### setAction

    public void setAction(java.lang.String action)

  Set the request's action.

### getActionHandler

    public java.lang.Object getActionHandler()

  Get the request's action handler. The action handler allows the onRequest() method to set the function object to be invoked for processing the request, overriding the action resolved from the request path.

  Returns:
    the action handler function

### setActionHandler

    public void setActionHandler(java.lang.Object handler)

  Set the request's action handler. The action handler allows the onRequest() method to set the function object to be invoked for processing the request, overriding the action resolved from the request path.

  Parameters:
    `handler` - the action handler

### getStartTime

    public long getStartTime()

  Get the time the request was created.

### setIfModifiedSince

    public void setIfModifiedSince(long since)

  Parameters:
    `since` - ...

### getIfModifiedSince

    public long getIfModifiedSince()

  Returns:
    ...

### setETags

    public void setETags(java.lang.String etagHeader)

  Parameters:
    `etagHeader` - ...

### getETags

    public java.util.Set getETags()

  Returns:
    ...

### hasETag

    public boolean hasETag(java.lang.String etag)

  Parameters:
    `etag` - ...
  Returns:
    ...

### getUsername

    public java.lang.String getUsername()

  Returns:
    ...

### getPassword

    public java.lang.String getPassword()

  Returns:
    ...

Copyright © 1998-1998-${year} Helma.org. All Rights Reserved.