public class HttpSessionRequestCache extends java.lang.Object implements RequestCache
RequestCache which stores the SavedRequest in the HttpSession.
The DefaultSavedRequest class is used as the implementation.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.commons.logging.Log |
logger |
| Constructor and Description |
|---|
HttpSessionRequestCache() |
| Modifier and Type | Method and Description |
|---|---|
javax.servlet.http.HttpServletRequest |
getMatchingRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns a wrapper around the saved request, if it matches the current request.
|
SavedRequest |
getRequest(javax.servlet.http.HttpServletRequest currentRequest,
javax.servlet.http.HttpServletResponse response)
Returns the saved request, leaving it cached.
|
void |
removeRequest(javax.servlet.http.HttpServletRequest currentRequest,
javax.servlet.http.HttpServletResponse response)
Removes the cached request.
|
void |
saveRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Stores the current request, provided the configuration properties allow it.
|
void |
setCreateSessionAllowed(boolean createSessionAllowed)
If
true, indicates that it is permitted to store the target URL and
exception information in a new HttpSession (the default). |
void |
setPortResolver(PortResolver portResolver) |
void |
setRequestMatcher(RequestMatcher requestMatcher)
Allows selective use of saved requests for a subset of requests.
|
void |
setSessionAttrName(java.lang.String sessionAttrName)
If the
sessionAttrName property is set, the request is stored in
the session using this attribute name. |
public void saveRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
saveRequest in interface RequestCacherequest - the request to be storedpublic SavedRequest getRequest(javax.servlet.http.HttpServletRequest currentRequest, javax.servlet.http.HttpServletResponse response)
RequestCachegetRequest in interface RequestCachecurrentRequest - the current requestpublic void removeRequest(javax.servlet.http.HttpServletRequest currentRequest,
javax.servlet.http.HttpServletResponse response)
RequestCacheremoveRequest in interface RequestCachecurrentRequest - the current request, allowing access to the cache.public javax.servlet.http.HttpServletRequest getMatchingRequest(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
RequestCachegetMatchingRequest in interface RequestCachepublic void setRequestMatcher(RequestMatcher requestMatcher)
saveRequest method.
If set, only matching requests will be cached.
requestMatcher - a request matching strategy which defines which requests
should be cached.public void setCreateSessionAllowed(boolean createSessionAllowed)
true, indicates that it is permitted to store the target URL and
exception information in a new HttpSession (the default). In
situations where you do not wish to unnecessarily create HttpSessions
- because the user agent will know the failed URL, such as with BASIC or Digest
authentication - you may wish to set this property to false.public void setPortResolver(PortResolver portResolver)
public void setSessionAttrName(java.lang.String sessionAttrName)
sessionAttrName property is set, the request is stored in
the session using this attribute name. Default is
"SPRING_SECURITY_SAVED_REQUEST".sessionAttrName - a new session attribute name.