public class SessionHandler extends Object implements PlatformHandler, 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 .
NOTE: This class has been automatically generated from theoriginal
non RX-ified interface using Vert.x codegen.Modifier and Type | Field and Description |
---|---|
static io.vertx.lang.rx.TypeArg<SessionHandler> |
__TYPE_ARG |
static boolean |
DEFAULT_COOKIE_HTTP_ONLY_FLAG
Default of whether the cookie has the HttpOnly flag set More info:
https://www.owasp.org/index.php/HttpOnly
|
static boolean |
DEFAULT_COOKIE_SECURE_FLAG
Default of whether the cookie has the 'secure' flag set to allow transmission
over https only.
|
static boolean |
DEFAULT_LAZY_SESSION
Default of whether the session should be created lazily.
|
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 String |
DEFAULT_SESSION_COOKIE_PATH
Default path of session cookie
|
static long |
DEFAULT_SESSION_TIMEOUT
Default time, in ms, that a session lasts for without being accessed before
expiring.
|
static int |
DEFAULT_SESSIONID_MIN_LENGTH
Default min length for a session id.
|
Constructor and Description |
---|
SessionHandler(Object delegate) |
SessionHandler(SessionHandler delegate) |
Modifier and Type | Method and Description |
---|---|
static SessionHandler |
create(SessionStore sessionStore)
Create a session handler
|
boolean |
equals(Object o) |
SessionHandler |
flush(RoutingContext ctx)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
SessionHandler |
flush(RoutingContext ctx,
boolean ignoreStatus)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
SessionHandler |
flush(RoutingContext ctx,
boolean ignoreStatus,
Handler<AsyncResult<Void>> handler)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
SessionHandler |
flush(RoutingContext ctx,
Handler<AsyncResult<Void>> handler)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
SessionHandler |
getDelegate() |
void |
handle(RoutingContext event)
Something has happened, so handle it.
|
int |
hashCode() |
static SessionHandler |
newInstance(SessionHandler arg) |
Session |
newSession(RoutingContext context)
Create a new session
|
Single<Void> |
rxFlush(RoutingContext ctx)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
Single<Void> |
rxFlush(RoutingContext ctx,
boolean ignoreStatus)
Flush a context session earlier to the store, this will allow the end user to have full control on the event of
a failure at the store level.
|
Single<Void> |
rxSetUser(RoutingContext context,
User user)
Set the user for the session
|
SessionHandler |
setCookieHttpOnlyFlag(boolean httpOnly)
Sets whether the 'HttpOnly' flag should be set for the session cookie.
|
SessionHandler |
setCookieless(boolean cookieless)
Use sessions based on url paths instead of cookies.
|
SessionHandler |
setCookieMaxAge(long cookieMaxAge)
Set a Cookie max-age to the session cookie.
|
SessionHandler |
setCookieSameSite(CookieSameSite policy)
Set the session cookie SameSite policy to use.
|
SessionHandler |
setCookieSecureFlag(boolean secure)
Sets whether the 'secure' flag should be set for the session cookie.
|
SessionHandler |
setLazySession(boolean lazySession)
Use a lazy session creation mechanism.
|
SessionHandler |
setMinLength(int minLength)
Set expected session id minimum length.
|
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 |
setSessionCookiePath(String sessionCookiePath)
Set the session cookie path
|
SessionHandler |
setSessionTimeout(long timeout)
Set the session timeout
|
SessionHandler |
setUser(RoutingContext context,
User user)
Set the user for the session
|
SessionHandler |
setUser(RoutingContext context,
User user,
Handler<AsyncResult<Void>> handler)
Set the user for the session
|
String |
toString() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
newInstance
public static final io.vertx.lang.rx.TypeArg<SessionHandler> __TYPE_ARG
public static final String DEFAULT_SESSION_COOKIE_NAME
public static final String DEFAULT_SESSION_COOKIE_PATH
public static final long DEFAULT_SESSION_TIMEOUT
public static final boolean DEFAULT_NAG_HTTPS
public static final boolean DEFAULT_COOKIE_HTTP_ONLY_FLAG
public static final boolean DEFAULT_COOKIE_SECURE_FLAG
public static final int DEFAULT_SESSIONID_MIN_LENGTH
public static final boolean DEFAULT_LAZY_SESSION
public SessionHandler(SessionHandler delegate)
public SessionHandler(Object delegate)
public SessionHandler getDelegate()
getDelegate
in interface PlatformHandler
public void handle(RoutingContext event)
handle
in interface Handler<RoutingContext>
handle
in interface PlatformHandler
event
- the event to handlepublic static SessionHandler create(SessionStore sessionStore)
sessionStore
- the session storepublic SessionHandler setSessionTimeout(long timeout)
timeout
- the timeout, in ms.public SessionHandler setNagHttps(boolean nag)
nag
- true to nagpublic SessionHandler setCookieSecureFlag(boolean secure)
secure
- true to set the secure flag on the cookiepublic SessionHandler setCookieHttpOnlyFlag(boolean httpOnly)
httpOnly
- true to set the HttpOnly flag on the cookiepublic SessionHandler setSessionCookieName(String sessionCookieName)
sessionCookieName
- the session cookie namepublic SessionHandler setSessionCookiePath(String sessionCookiePath)
sessionCookiePath
- the session cookie pathpublic SessionHandler setMinLength(int minLength)
minLength
- the session id minimal lengthpublic SessionHandler setCookieSameSite(CookieSameSite policy)
policy
- to use, null
for no policy.public SessionHandler setLazySession(boolean lazySession)
lazySession
- true to have a lazy session creation.public SessionHandler setCookieMaxAge(long cookieMaxAge)
cookieMaxAge
- a non negative max-age, note that 0 means expire now.public SessionHandler flush(RoutingContext ctx, Handler<AsyncResult<Void>> handler)
ctx
- the current contexthandler
- the event handler to signal a asynchronous response.public SessionHandler flush(RoutingContext ctx)
ctx
- the current contextpublic Single<Void> rxFlush(RoutingContext ctx)
ctx
- the current contextpublic SessionHandler flush(RoutingContext ctx, boolean ignoreStatus, Handler<AsyncResult<Void>> handler)
ctx
- the current contextignoreStatus
- flush regardless of response status codehandler
- the event handler to signal a asynchronous response.public SessionHandler flush(RoutingContext ctx, boolean ignoreStatus)
ctx
- the current contextignoreStatus
- flush regardless of response status codepublic Single<Void> rxFlush(RoutingContext ctx, boolean ignoreStatus)
ctx
- the current contextignoreStatus
- flush regardless of response status codepublic SessionHandler setCookieless(boolean cookieless)
cookieless
- true if a cookieless session should be usedpublic Session newSession(RoutingContext context)
context
- the routing contextpublic SessionHandler setUser(RoutingContext context, User user, Handler<AsyncResult<Void>> handler)
context
- the routing contextuser
- the userhandler
- the event handler to signal a asynchronous response.public SessionHandler setUser(RoutingContext context, User user)
context
- the routing contextuser
- the userpublic Single<Void> rxSetUser(RoutingContext context, User user)
context
- the routing contextuser
- the userpublic static SessionHandler newInstance(SessionHandler arg)
Copyright © 2024 Eclipse. All rights reserved.