public class CookieWebSessionIdResolver extends Object implements WebSessionIdResolver
WebSessionIdResolver
.Constructor and Description |
---|
CookieWebSessionIdResolver() |
Modifier and Type | Method and Description |
---|---|
void |
addCookieInitializer(Consumer<ResponseCookie.ResponseCookieBuilder> initializer)
Add a
Consumer for a ResponseCookieBuilder that will be invoked
for each cookie being built, just before the call to build() . |
void |
expireSession(ServerWebExchange exchange)
Instruct the client to end the current session.
|
Duration |
getCookieMaxAge()
Return the configured "Max-Age" attribute value for the session cookie.
|
String |
getCookieName()
Return the configured cookie name.
|
List<String> |
resolveSessionIds(ServerWebExchange exchange)
Resolve the session id's associated with the request.
|
void |
setCookieMaxAge(Duration maxAge)
Set the value for the "Max-Age" attribute of the cookie that holds the
session id.
|
void |
setCookieName(String cookieName)
Set the name of the cookie to use for the session id.
|
void |
setSessionId(ServerWebExchange exchange,
String id)
Send the given session id to the client.
|
public void setCookieName(String cookieName)
By default set to "SESSION".
cookieName
- the cookie namepublic String getCookieName()
public void setCookieMaxAge(Duration maxAge)
ResponseCookie.getMaxAge()
.
By default set to -1.
maxAge
- the maxAge duration valuepublic Duration getCookieMaxAge()
public void addCookieInitializer(Consumer<ResponseCookie.ResponseCookieBuilder> initializer)
Consumer
for a ResponseCookieBuilder
that will be invoked
for each cookie being built, just before the call to build()
.initializer
- consumer for a cookie builderpublic List<String> resolveSessionIds(ServerWebExchange exchange)
WebSessionIdResolver
resolveSessionIds
in interface WebSessionIdResolver
exchange
- the current exchangepublic void setSessionId(ServerWebExchange exchange, String id)
WebSessionIdResolver
setSessionId
in interface WebSessionIdResolver
exchange
- the current exchangeid
- the session idpublic void expireSession(ServerWebExchange exchange)
WebSessionIdResolver
expireSession
in interface WebSessionIdResolver
exchange
- the current exchange