org.springframework.security.wrapper
Class SavedRequestAwareWrapper
java.lang.Object
javax.servlet.ServletRequestWrapper
javax.servlet.http.HttpServletRequestWrapper
org.springframework.security.wrapper.SecurityContextHolderAwareRequestWrapper
org.springframework.security.wrapper.SavedRequestAwareWrapper
- All Implemented Interfaces:
- javax.servlet.http.HttpServletRequest, javax.servlet.ServletRequest
public class SavedRequestAwareWrapper
- extends SecurityContextHolderAwareRequestWrapper
Provides request parameters, headers and cookies from either an original request or a saved request.
Note that not all request parameters in the original request are emulated by this wrapper.
Nevertheless, the important data from the original request is emulated and this should prove
adequate for most purposes (in particular standard HTTP GET and POST operations).
Added into a request by SecurityContextHolderAwareRequestFilter
.
- Version:
- $Id: SavedRequestAwareWrapper.java 3136 2008-06-09 23:33:36Z luke_t $
- Author:
- Andrey Grebnev, Ben Alex
- See Also:
SecurityContextHolderAwareRequestFilter
Field Summary |
protected static java.util.Locale |
defaultLocale
The default Locale if none are specified. |
protected java.text.SimpleDateFormat[] |
formats
The set of SimpleDateFormat formats to use in getDateHeader(). |
protected static java.util.TimeZone |
GMT_ZONE
|
protected static org.apache.commons.logging.Log |
logger
|
protected SavedRequest |
savedRequest
|
Fields inherited from interface javax.servlet.http.HttpServletRequest |
BASIC_AUTH, CLIENT_CERT_AUTH, DIGEST_AUTH, FORM_AUTH |
Method Summary |
javax.servlet.http.Cookie[] |
getCookies()
|
long |
getDateHeader(java.lang.String name)
|
java.lang.String |
getHeader(java.lang.String name)
|
java.util.Enumeration |
getHeaderNames()
|
java.util.Enumeration |
getHeaders(java.lang.String name)
|
int |
getIntHeader(java.lang.String name)
|
java.util.Locale |
getLocale()
|
java.util.Enumeration |
getLocales()
|
java.lang.String |
getMethod()
|
java.lang.String |
getParameter(java.lang.String name)
If the parameter is available from the wrapped request then either
There is no saved request (it a normal request)
There is a saved request, but the request has been forwarded/included to a URL with parameters, either
supplementing or overriding the saved request values.
In both cases the value from the wrapped request should be used. |
java.util.Map |
getParameterMap()
|
java.util.Enumeration |
getParameterNames()
|
java.lang.String[] |
getParameterValues(java.lang.String name)
|
Methods inherited from class javax.servlet.http.HttpServletRequestWrapper |
getAuthType, getContextPath, getPathInfo, getPathTranslated, getQueryString, getRequestedSessionId, getRequestURI, getRequestURL, getServletPath, getSession, getSession, isRequestedSessionIdFromCookie, isRequestedSessionIdFromUrl, isRequestedSessionIdFromURL, isRequestedSessionIdValid |
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 |
logger
protected static final org.apache.commons.logging.Log logger
GMT_ZONE
protected static final java.util.TimeZone GMT_ZONE
defaultLocale
protected static java.util.Locale defaultLocale
- The default Locale if none are specified.
savedRequest
protected SavedRequest savedRequest
formats
protected 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.
SavedRequestAwareWrapper
public SavedRequestAwareWrapper(javax.servlet.http.HttpServletRequest request,
PortResolver portResolver,
java.lang.String rolePrefix)
getCookies
public javax.servlet.http.Cookie[] getCookies()
- Specified by:
getCookies
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getCookies
in class javax.servlet.http.HttpServletRequestWrapper
getDateHeader
public long getDateHeader(java.lang.String name)
- Specified by:
getDateHeader
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getDateHeader
in class javax.servlet.http.HttpServletRequestWrapper
getHeader
public java.lang.String getHeader(java.lang.String name)
- Specified by:
getHeader
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getHeader
in class javax.servlet.http.HttpServletRequestWrapper
getHeaderNames
public java.util.Enumeration getHeaderNames()
- Specified by:
getHeaderNames
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getHeaderNames
in class javax.servlet.http.HttpServletRequestWrapper
getHeaders
public java.util.Enumeration getHeaders(java.lang.String name)
- Specified by:
getHeaders
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getHeaders
in class javax.servlet.http.HttpServletRequestWrapper
getIntHeader
public int getIntHeader(java.lang.String name)
- Specified by:
getIntHeader
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getIntHeader
in class javax.servlet.http.HttpServletRequestWrapper
getLocale
public java.util.Locale getLocale()
- Specified by:
getLocale
in interface javax.servlet.ServletRequest
- Overrides:
getLocale
in class javax.servlet.ServletRequestWrapper
getLocales
public java.util.Enumeration getLocales()
- Specified by:
getLocales
in interface javax.servlet.ServletRequest
- Overrides:
getLocales
in class javax.servlet.ServletRequestWrapper
getMethod
public java.lang.String getMethod()
- Specified by:
getMethod
in interface javax.servlet.http.HttpServletRequest
- Overrides:
getMethod
in class javax.servlet.http.HttpServletRequestWrapper
getParameter
public java.lang.String getParameter(java.lang.String name)
- If the parameter is available from the wrapped request then either
- There is no saved request (it a normal request)
- There is a saved request, but the request has been forwarded/included to a URL with parameters, either
supplementing or overriding the saved request values.
In both cases the value from the wrapped request should be used.
If the value from the wrapped request is null, an attempt will be made to retrieve the parameter
from the SavedRequest, if available..
- Specified by:
getParameter
in interface javax.servlet.ServletRequest
- Overrides:
getParameter
in class javax.servlet.ServletRequestWrapper
getParameterMap
public java.util.Map getParameterMap()
- Specified by:
getParameterMap
in interface javax.servlet.ServletRequest
- Overrides:
getParameterMap
in class javax.servlet.ServletRequestWrapper
getParameterNames
public java.util.Enumeration getParameterNames()
- Specified by:
getParameterNames
in interface javax.servlet.ServletRequest
- Overrides:
getParameterNames
in class javax.servlet.ServletRequestWrapper
getParameterValues
public java.lang.String[] getParameterValues(java.lang.String name)
- Specified by:
getParameterValues
in interface javax.servlet.ServletRequest
- Overrides:
getParameterValues
in class javax.servlet.ServletRequestWrapper