velosurf.util
Class SavedRequest

java.lang.Object
  extended by velosurf.util.SavedRequest

public class SavedRequest
extends java.lang.Object

Object that saves the critical information from a request so that form-based authentication can reproduce it once the user has been authenticated.

IMPLEMENTATION NOTE - It is assumed that this object is accessed only from the context of a single thread, so no synchronization around internal collection classes is performed.

FIXME - Currently, this object has no mechanism to save or restore the data content of the request, although it does save request parameters so that a POST transaction can be faithfully duplicated.

View Source

The original source code is got from Apache Tomcat

Author:
Craig R. McClanahan, Andrey Grebnev <andrey.grebnev@blandware.com>

Field Summary
private  java.util.ArrayList cookies
          The set of Cookies associated with this Request.
private  java.util.HashMap headers
          The set of Headers associated with this Request.
private  java.util.ArrayList locales
          The set of Locales associated with this Request.
private  java.lang.String method
          The request method used on this Request.
private  java.util.HashMap parameters
          The set of request parameters associated with this Request.
private  java.lang.String pathInfo
          The request pathInfo associated with this Request.
private  java.lang.String queryString
          The query string associated with this Request.
private  java.lang.String requestURI
          The request URI associated with this Request.
 
Constructor Summary
SavedRequest()
           
 
Method Summary
 void addCookie(javax.servlet.http.Cookie cookie)
          Adds cookie to list of cookies
 void addHeader(java.lang.String name, java.lang.String value)
          Adds header
 void addLocale(java.util.Locale locale)
          Adds locale
 void addParameter(java.lang.String name, java.lang.String[] values)
          Adds parameter
 java.util.List getCookies()
          Returns list of cookies
 java.util.Iterator getHeaderNames()
          Returns iterator over header names
 java.util.Iterator getHeaderValues(java.lang.String name)
          Returns iterator over header values
 java.util.Iterator getLocales()
          Returns iterator over locales
 java.lang.String getMethod()
          Returns request method
 java.util.Map getParameterMap()
          Returns parameters
 java.util.Iterator getParameterNames()
          Returns iterator over parameter names
 java.lang.String[] getParameterValues(java.lang.String name)
          Returns parameter values
 java.lang.String getPathInfo()
          Returns path info
 java.lang.String getQueryString()
          Returns query string
 java.lang.String getRequestURI()
          Returns request URI
 java.lang.String getRequestURL()
          Gets uri with path info and query string
static SavedRequest saveRequest(javax.servlet.http.HttpServletRequest request)
          This method provides ability to create SavedRequest from HttpServletRequest
 void setMethod(java.lang.String method)
          Sets request method
 void setPathInfo(java.lang.String pathInfo)
          Sets path info
 void setQueryString(java.lang.String queryString)
          Sets query string
 void setRequestURI(java.lang.String requestURI)
          Sets request URI
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cookies

private java.util.ArrayList cookies
The set of Cookies associated with this Request.


headers

private java.util.HashMap headers
The set of Headers associated with this Request. Each key is a header name, while the value is a ArrayList containing one or more actual values for this header. The values are returned as an Iterator when you ask for them.


locales

private java.util.ArrayList locales
The set of Locales associated with this Request.


method

private java.lang.String method
The request method used on this Request.


parameters

private java.util.HashMap parameters
The set of request parameters associated with this Request. Each entry is keyed by the parameter name, pointing at a String array of the corresponding values.


queryString

private java.lang.String queryString
The query string associated with this Request.


requestURI

private java.lang.String requestURI
The request URI associated with this Request.


pathInfo

private java.lang.String pathInfo
The request pathInfo associated with this Request.

Constructor Detail

SavedRequest

public SavedRequest()
Method Detail

addCookie

public void addCookie(javax.servlet.http.Cookie cookie)
Adds cookie to list of cookies

Parameters:
cookie - cookie to add

getCookies

public java.util.List getCookies()
Returns list of cookies

Returns:
list of cookies

addHeader

public void addHeader(java.lang.String name,
                      java.lang.String value)
Adds header

Parameters:
name - header name
value - header value

getHeaderNames

public java.util.Iterator getHeaderNames()
Returns iterator over header names

Returns:
iterator over header names

getHeaderValues

public java.util.Iterator getHeaderValues(java.lang.String name)
Returns iterator over header values

Parameters:
name - header name
Returns:
iterator over header values

addLocale

public void addLocale(java.util.Locale locale)
Adds locale

Parameters:
locale - locale to add

getLocales

public java.util.Iterator getLocales()
Returns iterator over locales

Returns:
iterator over locales

getMethod

public java.lang.String getMethod()
Returns request method

Returns:
request method

setMethod

public void setMethod(java.lang.String method)
Sets request method

Parameters:
method - request method to set

addParameter

public void addParameter(java.lang.String name,
                         java.lang.String[] values)
Adds parameter

Parameters:
name - parameter name
values - parameter values

getParameterNames

public java.util.Iterator getParameterNames()
Returns iterator over parameter names

Returns:
iterator over parameter names

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
Returns parameter values

Parameters:
name - parameter name
Returns:
parameter values

getParameterMap

public java.util.Map getParameterMap()
Returns parameters

Returns:
parameters map

getQueryString

public java.lang.String getQueryString()
Returns query string

Returns:
query string

setQueryString

public void setQueryString(java.lang.String queryString)
Sets query string

Parameters:
queryString - query string to set

getRequestURI

public java.lang.String getRequestURI()
Returns request URI

Returns:
request URI

setRequestURI

public void setRequestURI(java.lang.String requestURI)
Sets request URI

Parameters:
requestURI - request URI to set

getPathInfo

public java.lang.String getPathInfo()
Returns path info

Returns:
path info

setPathInfo

public void setPathInfo(java.lang.String pathInfo)
Sets path info

Parameters:
pathInfo - path info to set

getRequestURL

public java.lang.String getRequestURL()
Gets uri with path info and query string

Returns:
uri with path info and query string

saveRequest

public static SavedRequest saveRequest(javax.servlet.http.HttpServletRequest request)
This method provides ability to create SavedRequest from HttpServletRequest

Parameters:
request - request to be saved
Returns:
saved request resulting SavedRequest


~ooOoo~