public class CookieWebSessionIdResolver extends Object implements WebSessionIdResolver
WebSessionIdResolver
.Constructor and Description |
---|
CookieWebSessionIdResolver() |
Modifier and Type | Method and Description |
---|---|
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 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