Class CompositeHttpSessionIdResolver

java.lang.Object
org.springframework.session.web.http.CompositeHttpSessionIdResolver
All Implemented Interfaces:
HttpSessionIdResolver

public class CompositeHttpSessionIdResolver extends Object implements HttpSessionIdResolver
Composite HttpSessionIdResolver implementation that iterates over a given collection of delegate HttpSessionIdResolver instances.
  • Constructor Details

    • CompositeHttpSessionIdResolver

      public CompositeHttpSessionIdResolver(HttpSessionIdResolver... resolvers)
  • Method Details

    • resolveSessionIds

      public List<String> resolveSessionIds(jakarta.servlet.http.HttpServletRequest request)
      Resolve the session ids associated with the provided HttpServletRequest. For example, the session id might come from a cookie or a request header.
      Specified by:
      resolveSessionIds in interface HttpSessionIdResolver
      Parameters:
      request - the current request
      Returns:
      the session ids
    • setSessionId

      public void setSessionId(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, String sessionId)
      Send the given session id to the client. This method is invoked when a new session is created and should inform a client what the new session id is. For example, it might create a new cookie with the session id in it or set an HTTP response header with the value of the new session id.
      Specified by:
      setSessionId in interface HttpSessionIdResolver
      Parameters:
      request - the current request
      response - the current response
      sessionId - the session id
    • expireSession

      public void expireSession(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Instruct the client to end the current session. This method is invoked when a session is invalidated and should inform a client that the session id is no longer valid. For example, it might remove a cookie with the session id in it or set an HTTP response header with an empty value indicating to the client to no longer submit that session id.
      Specified by:
      expireSession in interface HttpSessionIdResolver
      Parameters:
      request - the current request
      response - the current response