Class CustomRequestCache

  • All Implemented Interfaces:
    org.springframework.security.web.savedrequest.RequestCache

    public class CustomRequestCache
    extends org.springframework.security.web.savedrequest.HttpSessionRequestCache
    HttpSessionRequestCache that avoids saving internal framework requests.
    • Field Summary

      • Fields inherited from class org.springframework.security.web.savedrequest.HttpSessionRequestCache

        logger
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String resolveRedirectUrl()
      Unfortunately, it's not that easy to resolve the redirect URL from the saved request.
      void saveRequest​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
      • Methods inherited from class org.springframework.security.web.savedrequest.HttpSessionRequestCache

        getMatchingRequest, getRequest, removeRequest, setCreateSessionAllowed, setPortResolver, setRequestMatcher, setSessionAttrName
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • saveRequest

        public void saveRequest​(javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response)

        If the method is considered an internal request from the framework, we skip saving it.

        Specified by:
        saveRequest in interface org.springframework.security.web.savedrequest.RequestCache
        Overrides:
        saveRequest in class org.springframework.security.web.savedrequest.HttpSessionRequestCache
        See Also:
        SecurityUtils.isFrameworkInternalRequest(HttpServletRequest)
      • resolveRedirectUrl

        public java.lang.String resolveRedirectUrl()
        Unfortunately, it's not that easy to resolve the redirect URL from the saved request. But with some casting (we always use DefaultSavedRequest) and mangling we are able to get the request URI.