Package io.micronaut.session.http
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 Summary
ConstructorDescriptionHeadersHttpSessionIdStrategy
(HttpSessionConfiguration configuration) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
encodeId
(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response, Session session) Encode the given Session into the response.String[]
resolveIds
(io.micronaut.http.HttpRequest<?> message) Resolve the Session ID from the given HTTP message.
-
Constructor Details
-
HeadersHttpSessionIdStrategy
Constructor.- Parameters:
configuration
- The HTTP session configuration
-
-
Method Details
-
getHeaderNames
- Returns:
- The header names to check
-
resolveIds
Description copied from interface:HttpSessionIdResolver
Resolve the Session ID from the given HTTP message.- Specified by:
resolveIds
in interfaceHttpSessionIdResolver
- 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 interfaceHttpSessionIdEncoder
- Parameters:
request
- The requestresponse
- The responsesession
- The session
-