Class RequestTrans

java.lang.Object
helma.framework.RequestTrans
All Implemented Interfaces:
Serializable

public class RequestTrans extends Object implements 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:
  • Field Details

  • Constructor Details

    • RequestTrans

      public RequestTrans(String method, 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, String path)
      Create a new request transmitter with the given data map.
  • Method Details

    • 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(String name, javax.servlet.http.Cookie cookie)
      Set a cookie
      Parameters:
      name - the cookie name
      cookie - the cookie
    • getCookies

      public Map getCookies()
      Returns:
      a map containing the cookies sent with this request
    • getParams

      public Map getParams()
      Returns:
      the combined query and post parameters for this request
    • getQueryParams

      public Map getQueryParams()
      Returns:
      get the query parameters for this request
    • getPostParams

      public Map getPostParams()
      Returns:
      get the post parameters for this request
    • setParameters

      public void setParameters(Map parameters, boolean isPost)
      set the request parameters
    • addPostParam

      public void addPostParam(String name, Object value)
      Add a post parameter to the request
      Parameters:
      name - the parameter name
      value - the parameter value
    • set

      public void set(String name, Object value)
      Set a parameter value in this request transmitter. This parses foo[bar][baz] as nested objects/maps.
    • get

      public Object get(String name)
      Get a value from the requests map by key.
    • getRequestData

      public 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 String getHeader(String name)
      Proxy to HttpServletRequest.getHeader().
      Parameters:
      name - the header name
      Returns:
      the header value, or null
    • getHeaders

      public String[] getHeaders(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(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(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 Object
    • equals

      public boolean equals(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 Object
    • getMethod

      public 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(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 String getSession()
      Get the request's session id
    • setSession

      public void setSession(String session)
      Set the request's session id
    • getPath

      public String getPath()
      Get the request's path
    • getUri

      public String getUri()
      Get the request's path
    • getAction

      public String getAction()
      Get the request's action.
    • setAction

      public void setAction(String action)
      Set the request's action.
    • getActionHandler

      public 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(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(String etagHeader)
      Parameters:
      etagHeader - ...
    • getETags

      public Set getETags()
      Returns:
      ...
    • hasETag

      public boolean hasETag(String etag)
      Parameters:
      etag - ...
      Returns:
      ...
    • getUsername

      public String getUsername()
      Returns:
      ...
    • getPassword

      public String getPassword()
      Returns:
      ...
    • toString

      public String toString()
      Overrides:
      toString in class Object