velosurf.util
Class SavedRequestWrapper

java.lang.Object
  extended by javax.servlet.ServletRequestWrapper
      extended by javax.servlet.http.HttpServletRequestWrapper
          extended by velosurf.util.SavedRequestWrapper
All Implemented Interfaces:
javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest

public class SavedRequestWrapper
extends javax.servlet.http.HttpServletRequestWrapper

This class provides request parameters, headers, cookies from original requrest or saved request.

Author:
Andrey Grebnev <andrey.grebnev@blandware.com>, Claude Brisson

Field Summary
private static java.util.Locale defaultLocale
          The default Locale if none are specified.
private  java.text.SimpleDateFormat[] formats
          The set of SimpleDateFormat formats to use in getDateHeader().
private static java.util.TimeZone GMT_ZONE
          timezone.
private  SavedRequest savedRequest
          the saved request.
 
Fields inherited from interface javax.servlet.http.HttpServletRequest
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH
 
Constructor Summary
SavedRequestWrapper(javax.servlet.http.HttpServletRequest request, SavedRequest saved)
          Constructor
 
Method Summary
 javax.servlet.http.Cookie[] getCookies()
          The default behavior of this method is to return getCookies() on the wrapped request object.
 long getDateHeader(java.lang.String name)
          The default behavior of this method is to return getDateHeader(String name) on the wrapped request object.
 java.lang.String getHeader(java.lang.String name)
          The default behavior of this method is to return getHeader(String name) on the wrapped request object.
 java.util.Enumeration getHeaderNames()
          The default behavior of this method is to return getHeaderNames() on the wrapped request object.
 java.util.Enumeration getHeaders(java.lang.String name)
          The default behavior of this method is to return getHeaders(String name) on the wrapped request object.
 int getIntHeader(java.lang.String name)
          The default behavior of this method is to return getIntHeader(String name) on the wrapped request object.
 java.util.Locale getLocale()
          The default behavior of this method is to return getLocale() on the wrapped request object.
 java.util.Enumeration getLocales()
          The default behavior of this method is to return getLocales() on the wrapped request object.
 java.lang.String getMethod()
          The default behavior of this method is to return getMethod() on the wrapped request object.
 java.lang.String getParameter(java.lang.String name)
          The default behavior of this method is to return getParameter(String name) on the wrapped request object.
 java.util.Map getParameterMap()
          The default behavior of this method is to return getParameterMap() on the wrapped request object.
 java.util.Enumeration getParameterNames()
          The default behavior of this method is to return getParameterNames() on the wrapped request object.
 java.lang.String[] getParameterValues(java.lang.String name)
          The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.
 
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper
getAuthType, getContextPath, getPathInfo, getPathTranslated, getQueryString, getRemoteUser, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, getUserPrincipal, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid, isUserInRole
 
Methods inherited from class javax.servlet.ServletRequestWrapper
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequest, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding, setRequest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.servlet.ServletRequest
getAttribute, getAttributeNames, getCharacterEncoding, getContentLength, getContentType, getInputStream, getLocalAddr, getLocalName, getLocalPort, getProtocol, getReader, getRealPath, getRemoteAddr, getRemoteHost, getRemotePort, getRequestDispatcher, getScheme, getServerName, getServerPort, isSecure, removeAttribute, setAttribute, setCharacterEncoding
 

Field Detail

savedRequest

private SavedRequest savedRequest
the saved request.


GMT_ZONE

private static final java.util.TimeZone GMT_ZONE
timezone.


defaultLocale

private static final java.util.Locale defaultLocale
The default Locale if none are specified.


formats

private java.text.SimpleDateFormat[] formats
The set of SimpleDateFormat formats to use in getDateHeader(). Notice that because SimpleDateFormat is not thread-safe, we can't declare formats[] as a static variable.

Constructor Detail

SavedRequestWrapper

public SavedRequestWrapper(javax.servlet.http.HttpServletRequest request,
                           SavedRequest saved)
Constructor

Parameters:
request - to save
Method Detail

getMethod

public java.lang.String getMethod()
The default behavior of this method is to return getMethod() on the wrapped request object.

Specified by:
getMethod in interface javax.servlet.http.HttpServletRequest
Overrides:
getMethod in class javax.servlet.http.HttpServletRequestWrapper
Returns:
the HTTP method

getHeader

public java.lang.String getHeader(java.lang.String name)
The default behavior of this method is to return getHeader(String name) on the wrapped request object.

Specified by:
getHeader in interface javax.servlet.http.HttpServletRequest
Overrides:
getHeader in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
name - header name
Returns:
header value or null

getIntHeader

public int getIntHeader(java.lang.String name)
The default behavior of this method is to return getIntHeader(String name) on the wrapped request object.

Specified by:
getIntHeader in interface javax.servlet.http.HttpServletRequest
Overrides:
getIntHeader in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
name - integer header name
Returns:
integer header value or -1

getDateHeader

public long getDateHeader(java.lang.String name)
The default behavior of this method is to return getDateHeader(String name) on the wrapped request object.

Specified by:
getDateHeader in interface javax.servlet.http.HttpServletRequest
Overrides:
getDateHeader in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
name - date header name
Returns:
date header value or null

getHeaderNames

public java.util.Enumeration getHeaderNames()
The default behavior of this method is to return getHeaderNames() on the wrapped request object.

Specified by:
getHeaderNames in interface javax.servlet.http.HttpServletRequest
Overrides:
getHeaderNames in class javax.servlet.http.HttpServletRequestWrapper
Returns:
an enumeration of header names

getHeaders

public java.util.Enumeration getHeaders(java.lang.String name)
The default behavior of this method is to return getHeaders(String name) on the wrapped request object.

Specified by:
getHeaders in interface javax.servlet.http.HttpServletRequest
Overrides:
getHeaders in class javax.servlet.http.HttpServletRequestWrapper
Parameters:
name - multivalued header
Returns:
enumeration of values for this header

getCookies

public javax.servlet.http.Cookie[] getCookies()
The default behavior of this method is to return getCookies() on the wrapped request object.

Specified by:
getCookies in interface javax.servlet.http.HttpServletRequest
Overrides:
getCookies in class javax.servlet.http.HttpServletRequestWrapper
Returns:
cookies array

getParameterValues

public java.lang.String[] getParameterValues(java.lang.String name)
The default behavior of this method is to return getParameterValues(String name) on the wrapped request object.

Specified by:
getParameterValues in interface javax.servlet.ServletRequest
Overrides:
getParameterValues in class javax.servlet.ServletRequestWrapper
Parameters:
name - parameter name

getParameterNames

public java.util.Enumeration getParameterNames()
The default behavior of this method is to return getParameterNames() on the wrapped request object.

Specified by:
getParameterNames in interface javax.servlet.ServletRequest
Overrides:
getParameterNames in class javax.servlet.ServletRequestWrapper
Returns:
enumeration of parameter names

getParameterMap

public java.util.Map getParameterMap()
The default behavior of this method is to return getParameterMap() on the wrapped request object.

Specified by:
getParameterMap in interface javax.servlet.ServletRequest
Overrides:
getParameterMap in class javax.servlet.ServletRequestWrapper
Returns:
parameter map

getParameter

public java.lang.String getParameter(java.lang.String name)
The default behavior of this method is to return getParameter(String name) on the wrapped request object.

Specified by:
getParameter in interface javax.servlet.ServletRequest
Overrides:
getParameter in class javax.servlet.ServletRequestWrapper
Parameters:
name - parameter name
Returns:
parameter value

getLocales

public java.util.Enumeration getLocales()
The default behavior of this method is to return getLocales() on the wrapped request object.

Specified by:
getLocales in interface javax.servlet.ServletRequest
Overrides:
getLocales in class javax.servlet.ServletRequestWrapper
Returns:
enumeration of locales

getLocale

public java.util.Locale getLocale()
The default behavior of this method is to return getLocale() on the wrapped request object.

Specified by:
getLocale in interface javax.servlet.ServletRequest
Overrides:
getLocale in class javax.servlet.ServletRequestWrapper
Returns:
locale


~ooOoo~