Class DefaultSavedRequest

java.lang.Object
org.springframework.security.web.savedrequest.DefaultSavedRequest
All Implemented Interfaces:
Serializable, SavedRequest

public class DefaultSavedRequest extends Object implements SavedRequest
Represents central information from a HttpServletRequest.

This class is used by AbstractAuthenticationProcessingFilter and SavedRequestAwareWrapper to reproduce the request after successful authentication. An instance of this class is stored at the time of an authentication exception by ExceptionTranslationFilter.

IMPLEMENTATION NOTE: It is assumed that this object is accessed only from the context of a single thread, so no synchronization around internal collection classes is performed.

This class is based on code in Apache Tomcat.

See Also:
  • Field Details

    • logger

      protected static final org.apache.commons.logging.Log logger
  • Constructor Details

    • DefaultSavedRequest

      public DefaultSavedRequest(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)
  • Method Details

    • doesRequestMatch

      public boolean doesRequestMatch(jakarta.servlet.http.HttpServletRequest request, PortResolver portResolver)
      Determines if the current request matches the DefaultSavedRequest.

      All URL arguments are considered but not cookies, locales, headers or parameters.

      Parameters:
      request - the actual request to be matched against this one
      portResolver - used to obtain the server port of the request
      Returns:
      true if the request is deemed to match this one.
    • getContextPath

      public String getContextPath()
    • getCookies

      public List<jakarta.servlet.http.Cookie> getCookies()
      Specified by:
      getCookies in interface SavedRequest
    • getRedirectUrl

      public String getRedirectUrl()
      Indicates the URL that the user agent used for this request.
      Specified by:
      getRedirectUrl in interface SavedRequest
      Returns:
      the full URL of this request
    • getHeaderNames

      public Collection<String> getHeaderNames()
      Specified by:
      getHeaderNames in interface SavedRequest
    • getHeaderValues

      public List<String> getHeaderValues(String name)
      Specified by:
      getHeaderValues in interface SavedRequest
    • getLocales

      public List<Locale> getLocales()
      Specified by:
      getLocales in interface SavedRequest
    • getMethod

      public String getMethod()
      Specified by:
      getMethod in interface SavedRequest
    • getParameterMap

      public Map<String,String[]> getParameterMap()
      Specified by:
      getParameterMap in interface SavedRequest
    • getParameterNames

      public Collection<String> getParameterNames()
    • getParameterValues

      public String[] getParameterValues(String name)
      Specified by:
      getParameterValues in interface SavedRequest
    • getPathInfo

      public String getPathInfo()
    • getQueryString

      public String getQueryString()
    • getRequestURI

      public String getRequestURI()
    • getRequestURL

      public String getRequestURL()
    • getScheme

      public String getScheme()
    • getServerName

      public String getServerName()
    • getServerPort

      public int getServerPort()
    • getServletPath

      public String getServletPath()
    • toString

      public String toString()
      Overrides:
      toString in class Object