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
ConstructorsConstructorDescriptionHeadersHttpSessionIdStrategy(HttpSessionConfiguration configuration) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidencodeId(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:HttpSessionIdResolverResolve the Session ID from the given HTTP message.- Specified by:
resolveIdsin 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:HttpSessionIdEncoderEncode the given Session into the response. The strategy can choose to use headers, cookies or whatever strategy suites the use case.- Specified by:
encodeIdin interfaceHttpSessionIdEncoder- Parameters:
request- The requestresponse- The responsesession- The session
-