Class HeadersHttpSessionIdStrategy

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

@Singleton @Requires(property="micronaut.session.http.header", notEquals="false") public class HeadersHttpSessionIdStrategy extends Object implements HttpSessionIdStrategy
Implementation that uses common HTTP headers to resolve the Session ID.
Since:
1.0
Author:
Graeme Rocher
  • Constructor Details

    • HeadersHttpSessionIdStrategy

      public HeadersHttpSessionIdStrategy(HttpSessionConfiguration configuration)
      Constructor.
      Parameters:
      configuration - The HTTP session configuration
  • Method Details

    • getHeaderNames

      public String[] getHeaderNames()
      Returns:
      The header names to check
    • 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