Package io.micronaut.session.http
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 Summary
ConstructorDescriptionCookieHttpSessionStrategy
(HttpSessionConfiguration configuration) Constructor.CookieHttpSessionStrategy
(HttpSessionConfiguration configuration, CookieHttpSessionIdGenerator cookieHttpSessionIdGenerator) 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.resolveIds
(io.micronaut.http.HttpRequest<?> message) Resolve the Session ID from the given HTTP message.
-
Constructor Details
-
CookieHttpSessionStrategy
Constructor.- Parameters:
configuration
- The HTTP session configuration
-
CookieHttpSessionStrategy
public CookieHttpSessionStrategy(HttpSessionConfiguration configuration, CookieHttpSessionIdGenerator cookieHttpSessionIdGenerator) Constructor.- Parameters:
configuration
- The HTTP session configurationcookieHttpSessionIdGenerator
- Cookie HTTP Session Id generator
-
-
Method Details
-
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
-
getConfiguration
- Returns:
- The HTTP session configuration
-