public interface SessionHandler extends Handler<RoutingContext>
Session
for each browser session.
It looks up the session for each request based on a session cookie which contains a session ID. It stores the session when the response is ended in the session store.
The session is available on the routing context with RoutingContext.session()
.
The session handler requires a CookieHandler
to be on the routing chain before it.
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_NAG_HTTPS
Default of whether a nagging log warning should be written if the session handler is accessed over HTTP, not
HTTPS
|
static String |
DEFAULT_SESSION_COOKIE_NAME
Default name of session cookie
|
static long |
DEFAULT_SESSION_TIMEOUT
Default time, in ms, that a session lasts for without being accessed before expiring.
|
Modifier and Type | Method and Description |
---|---|
static SessionHandler |
create(SessionStore sessionStore)
Create a session handler
|
SessionHandler |
setNagHttps(boolean nag)
Set whether a nagging log warning should be written if the session handler is accessed over HTTP, not
HTTPS
|
SessionHandler |
setSessionCookieName(String sessionCookieName)
Set the session cookie name
|
SessionHandler |
setSessionTimeout(long timeout)
Set the session timeout
|
static final String DEFAULT_SESSION_COOKIE_NAME
static final long DEFAULT_SESSION_TIMEOUT
static final boolean DEFAULT_NAG_HTTPS
static SessionHandler create(SessionStore sessionStore)
sessionStore
- the session storeSessionHandler setSessionTimeout(long timeout)
timeout
- the timeout, in ms.SessionHandler setNagHttps(boolean nag)
nag
- true to nagSessionHandler setSessionCookieName(String sessionCookieName)
sessionCookieName
- the session cookie nameCopyright © 2015. All Rights Reserved.