Interface RequestCache

All Known Implementing Classes:
CookieRequestCache, HttpSessionRequestCache, NullRequestCache

public interface RequestCache
Implements "saved request" logic, allowing a single request to be retrieved and restarted after redirecting to an authentication mechanism.
Since:
3.0
  • Method Summary

    Modifier and Type
    Method
    Description
    jakarta.servlet.http.HttpServletRequest
    getMatchingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Returns a wrapper around the saved request, if it matches the current request.
    getRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Returns the saved request, leaving it cached.
    void
    removeRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Removes the cached request.
    void
    saveRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
    Caches the current request for later retrieval, once authentication has taken place.
  • Method Details

    • saveRequest

      void saveRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Caches the current request for later retrieval, once authentication has taken place. Used by ExceptionTranslationFilter.
      Parameters:
      request - the request to be stored
    • getRequest

      SavedRequest getRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Returns the saved request, leaving it cached.
      Parameters:
      request - the current request
      Returns:
      the saved request which was previously cached, or null if there is none.
    • getMatchingRequest

      jakarta.servlet.http.HttpServletRequest getMatchingRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Returns a wrapper around the saved request, if it matches the current request. The saved request should be removed from the cache.
      Parameters:
      request -
      response -
      Returns:
      the wrapped save request, if it matches the original, or null if there is no cached request or it doesn't match.
    • removeRequest

      void removeRequest(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Removes the cached request.
      Parameters:
      request - the current request, allowing access to the cache.