public class CookieWebSessionIdResolver extends java.lang.Object implements WebSessionIdResolver
WebSessionIdResolver
.Modifier and Type | Field and Description |
---|---|
private java.time.Duration |
cookieMaxAge |
private java.lang.String |
cookieName |
Constructor and Description |
---|
CookieWebSessionIdResolver() |
Modifier and Type | Method and Description |
---|---|
java.time.Duration |
getCookieMaxAge()
Return the configured "Max-Age" attribute value for the session cookie.
|
java.lang.String |
getCookieName()
Return the configured cookie name.
|
java.util.List<java.lang.String> |
resolveSessionIds(ServerWebExchange exchange)
Resolve the session id's associated with the request.
|
void |
setCookieMaxAge(java.time.Duration maxAge)
Set the value for the "Max-Age" attribute of the cookie that holds the
session id.
|
void |
setCookieName(java.lang.String cookieName)
Set the name of the cookie to use for the session id.
|
void |
setSessionId(ServerWebExchange exchange,
java.lang.String id)
Send the given session id to the client or if the session id is "null"
instruct the client to end the current session.
|
private java.lang.String cookieName
private java.time.Duration cookieMaxAge
public void setCookieName(java.lang.String cookieName)
By default set to "SESSION".
cookieName
- the cookie namepublic java.lang.String getCookieName()
public void setCookieMaxAge(java.time.Duration maxAge)
ResponseCookie.getMaxAge()
.
By default set to -1.
maxAge
- the maxAge duration valuepublic java.time.Duration getCookieMaxAge()
public java.util.List<java.lang.String> resolveSessionIds(ServerWebExchange exchange)
WebSessionIdResolver
resolveSessionIds
in interface WebSessionIdResolver
exchange
- the current exchangepublic void setSessionId(ServerWebExchange exchange, java.lang.String id)
WebSessionIdResolver
setSessionId
in interface WebSessionIdResolver
exchange
- the current exchangeid
- the session id