public class

HttpSessionRequestCache

extends Object
implements RequestCache
java.lang.Object
   ↳ org.springframework.security.web.savedrequest.HttpSessionRequestCache

Class Overview

RequestCache which stores the SavedRequest in the HttpSession. The DefaultSavedRequest class is used as the implementation.

Summary

Fields
protected final Log logger
Public Constructors
HttpSessionRequestCache()
Public Methods
HttpServletRequest getMatchingRequest(HttpServletRequest request, HttpServletResponse response)
Returns a wrapper around the saved request, if it matches the current request.
SavedRequest getRequest(HttpServletRequest currentRequest, HttpServletResponse response)
Returns the saved request, leaving it cached.
void removeRequest(HttpServletRequest currentRequest, HttpServletResponse response)
Removes the cached request.
void saveRequest(HttpServletRequest request, 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.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.security.web.savedrequest.RequestCache

Fields

protected final Log logger

Public Constructors

public HttpSessionRequestCache ()

Public Methods

public HttpServletRequest getMatchingRequest (HttpServletRequest request, HttpServletResponse response)

Returns a wrapper around the saved request, if it matches the current request. The saved request should be removed from the cache.

Returns
  • the wrapped save request, if it matches the original, or null if there is no cached request or it doesn't match.

public SavedRequest getRequest (HttpServletRequest currentRequest, HttpServletResponse response)

Returns the saved request, leaving it cached.

Parameters
currentRequest the current request
Returns
  • the saved request which was previously cached, or null if there is none.

public void removeRequest (HttpServletRequest currentRequest, HttpServletResponse response)

Removes the cached request.

Parameters
currentRequest the current request, allowing access to the cache.

public void saveRequest (HttpServletRequest request, HttpServletResponse response)

Stores the current request, provided the configuration properties allow it.

Parameters
request the request to be stored

public 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). 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 setRequestMatcher (RequestMatcher requestMatcher)

Allows selective use of saved requests for a subset of requests. By default any request will be cached by the saveRequest method.

If set, only matching requests will be cached.

Parameters
requestMatcher a request matching strategy which defines which requests should be cached.