Class CookieHttpSessionStrategy

java.lang.Object
io.micronaut.session.http.CookieHttpSessionStrategy
All Implemented Interfaces:
HttpSessionIdEncoder, HttpSessionIdResolver, HttpSessionIdStrategy

@Singleton @Requires(property="micronaut.session.http.cookie", notEquals="false") public class CookieHttpSessionStrategy extends Object implements HttpSessionIdStrategy
Resolves Session identifiers from cookies.
Since:
1.0
Author:
Graeme Rocher
  • Constructor Details

    • CookieHttpSessionStrategy

      public CookieHttpSessionStrategy(HttpSessionConfiguration configuration)
      Constructor.
      Parameters:
      configuration - The HTTP session configuration
    • CookieHttpSessionStrategy

      public CookieHttpSessionStrategy(HttpSessionConfiguration configuration, CookieHttpSessionIdGenerator cookieHttpSessionIdGenerator)
      Constructor.
      Parameters:
      configuration - The HTTP session configuration
      cookieHttpSessionIdGenerator - Cookie HTTP Session Id generator
  • Method Details

    • resolveIds

      public List<String> resolveIds(io.micronaut.http.HttpRequest<?> message)
      Description copied from interface: HttpSessionIdResolver
      Resolve the Session ID from the given HTTP message.
      Specified by:
      resolveIds in interface HttpSessionIdResolver
      Parameters:
      message - The session ID
      Returns:
      An Optional
    • encodeId

      public void encodeId(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response, Session session)
      Description copied from interface: HttpSessionIdEncoder
      Encode the given Session into the response. The strategy can choose to use headers, cookies or whatever strategy suites the use case.
      Specified by:
      encodeId in interface HttpSessionIdEncoder
      Parameters:
      request - The request
      response - The response
      session - The session
    • getConfiguration

      public HttpSessionConfiguration getConfiguration()
      Returns:
      The HTTP session configuration