Package helma.framework
Class RequestTrans
java.lang.Object
helma.framework.RequestTrans
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionRequestTrans
(String method, String path) Create a new Request transmitter with an empty data map.RequestTrans
(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, String path) Create a new request transmitter with the given data map. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPostParam
(String name, Object value) Add a post parameter to the requestboolean
Return true if we should try to handle this as XML-RPC request.boolean
A request is considered equal to another one if it has the same method, path, session, request data, and conditional get data.Get a value from the requests map by key.Get the request's action.Get the request's action handler.long
getDateHeader
(String name) Proxy to HttpServletRequest.getDateHeader(), fails silently by returning -1.getETags()
Proxy to HttpServletRequest.getHeader().String[]
getHeaders
(String name) Proxy to HttpServletRequest.getHeaders(), returns header values as string array.long
int
getIntHeader
(String name) Proxy to HttpServletRequest.getIntHeader(), fails silently by returning -1.Return the method of the request.getPath()
Get the request's pathGet the data map for this request transmitter.javax.servlet.http.HttpServletRequest
Returns the Servlet request represented by this RequestTrans instance.javax.servlet.http.HttpServletResponse
Returns the Servlet response for this request.Get the request's session idlong
Get the time the request was created.getUri()
Get the request's pathboolean
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 a parameter value in this request transmitter.void
Set the request's action.void
setActionHandler
(Object handler) Set the request's action handler.void
Set a cookievoid
void
setIfModifiedSince
(long since) void
Set the method of this request.void
setParameters
(Map parameters, boolean isPost) set the request parametersvoid
setSession
(String session) Set the request's session idtoString()
-
Field Details
-
GET
- See Also:
-
POST
- See Also:
-
DELETE
- See Also:
-
HEAD
- See Also:
-
OPTIONS
- See Also:
-
PUT
- See Also:
-
TRACE
- See Also:
-
XMLRPC
- See Also:
-
EXTERNAL
- See Also:
-
INTERNAL
- See Also:
-
-
Constructor Details
-
RequestTrans
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 thatcheckXmlRpc()
returns true and a matching XML-RPC action was found.- Returns:
- true if this request is handled as XML-RPC request.
-
setCookie
Set a cookie- Parameters:
name
- the cookie namecookie
- the cookie
-
getCookies
- Returns:
- a map containing the cookies sent with this request
-
getParams
- Returns:
- the combined query and post parameters for this request
-
getQueryParams
- Returns:
- get the query parameters for this request
-
getPostParams
- Returns:
- get the post parameters for this request
-
setParameters
set the request parameters -
addPostParam
Add a post parameter to the request- Parameters:
name
- the parameter namevalue
- the parameter value
-
set
Set a parameter value in this request transmitter. This parses foo[bar][baz] as nested objects/maps. -
get
Get a value from the requests map by key. -
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
Proxy to HttpServletRequest.getHeader().- Parameters:
name
- the header name- Returns:
- the header value, or null
-
getHeaders
Proxy to HttpServletRequest.getHeaders(), returns header values as string array.- Parameters:
name
- the header name- Returns:
- the header values as string array
-
getIntHeader
Proxy to HttpServletRequest.getIntHeader(), fails silently by returning -1.- Parameters:
name
- the header name- Returns:
- the header parsed as integer or -1
-
getDateHeader
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. -
equals
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. -
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
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
Get the request's session id -
setSession
Set the request's session id -
getPath
Get the request's path -
getUri
Get the request's path -
getAction
Get the request's action. -
setAction
Set the request's action. -
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
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
- Parameters:
etagHeader
- ...
-
getETags
- Returns:
- ...
-
hasETag
- Parameters:
etag
- ...- Returns:
- ...
-
getUsername
- Returns:
- ...
-
getPassword
- Returns:
- ...
-
toString
-