Class CookieRequestCache
- java.lang.Object
-
- org.springframework.security.web.savedrequest.CookieRequestCache
-
- All Implemented Interfaces:
RequestCache
public class CookieRequestCache extends java.lang.Object implements RequestCache
An Implementation ofRequestCache
which saves the original request URI in a cookie.- Since:
- 5.4
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.commons.logging.Log
logger
-
Constructor Summary
Constructors Constructor Description CookieRequestCache()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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 request, javax.servlet.http.HttpServletResponse response)
Returns the saved request, leaving it cached.void
removeRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Removes the cached request.void
saveRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Caches the current request for later retrieval, once authentication has taken place.void
setRequestMatcher(RequestMatcher requestMatcher)
Allows selective use of saved requests for a subset of requests.
-
-
-
Method Detail
-
saveRequest
public void saveRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:RequestCache
Caches the current request for later retrieval, once authentication has taken place. Used by ExceptionTranslationFilter.- Specified by:
saveRequest
in interfaceRequestCache
- Parameters:
request
- the request to be stored
-
getRequest
public SavedRequest getRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:RequestCache
Returns the saved request, leaving it cached.- Specified by:
getRequest
in interfaceRequestCache
- Parameters:
request
- the current request- Returns:
- the saved request which was previously cached, or null if there is none.
-
getMatchingRequest
public javax.servlet.http.HttpServletRequest getMatchingRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:RequestCache
Returns a wrapper around the saved request, if it matches the current request. The saved request should be removed from the cache.- Specified by:
getMatchingRequest
in interfaceRequestCache
- Returns:
- the wrapped save request, if it matches the original, or null if there is no cached request or it doesn't match.
-
removeRequest
public void removeRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
Description copied from interface:RequestCache
Removes the cached request.- Specified by:
removeRequest
in interfaceRequestCache
- Parameters:
request
- the current request, allowing access to the cache.
-
setRequestMatcher
public void setRequestMatcher(RequestMatcher requestMatcher)
Allows selective use of saved requests for a subset of requests. By default any request will be cached by thesaveRequest
method.If set, only matching requests will be cached.
- Parameters:
requestMatcher
- a request matching strategy which defines which requests should be cached.
-
-