类 CookieWebSessionIdResolver
- java.lang.Object
- org.springframework.web.server.session.CookieWebSessionIdResolver
- 所有已实现的接口:
WebSessionIdResolver
public class CookieWebSessionIdResolver extends Object implements WebSessionIdResolver
Cookie-basedWebSessionIdResolver
.- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev, Brian Clozel
构造器概要
构造器 构造器 说明 CookieWebSessionIdResolver()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
addCookieInitializer(Consumer<ResponseCookie.ResponseCookieBuilder> initializer)
Add aConsumer
for aResponseCookieBuilder
that will be invoked for each cookie being built, just before the call tobuild()
.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.
构造器详细资料
CookieWebSessionIdResolver
public CookieWebSessionIdResolver()
方法详细资料
setCookieName
public void setCookieName(String cookieName)
Set the name of the cookie to use for the session id.By default set to "SESSION".
- 参数:
cookieName
- the cookie name
getCookieName
public String getCookieName()
Return the configured cookie name.
setCookieMaxAge
public void setCookieMaxAge(Duration maxAge)
Set the value for the "Max-Age" attribute of the cookie that holds the session id. For the range of values seeResponseCookie.getMaxAge()
.By default set to -1.
- 参数:
maxAge
- the maxAge duration value
getCookieMaxAge
public Duration getCookieMaxAge()
Return the configured "Max-Age" attribute value for the session cookie.
addCookieInitializer
public void addCookieInitializer(Consumer<ResponseCookie.ResponseCookieBuilder> initializer)
Add aConsumer
for aResponseCookieBuilder
that will be invoked for each cookie being built, just before the call tobuild()
.- 参数:
initializer
- consumer for a cookie builder- 从以下版本开始:
- 5.1
resolveSessionIds
public List<String> resolveSessionIds(ServerWebExchange exchange)
从接口复制的说明:WebSessionIdResolver
Resolve the session id's associated with the request.- 指定者:
resolveSessionIds
在接口中WebSessionIdResolver
- 参数:
exchange
- the current exchange- 返回:
- the session id's or an empty list
setSessionId
public void setSessionId(ServerWebExchange exchange, String id)
从接口复制的说明:WebSessionIdResolver
Send the given session id to the client.- 指定者:
setSessionId
在接口中WebSessionIdResolver
- 参数:
exchange
- the current exchangeid
- the session id
expireSession
public void expireSession(ServerWebExchange exchange)
从接口复制的说明:WebSessionIdResolver
Instruct the client to end the current session.- 指定者:
expireSession
在接口中WebSessionIdResolver
- 参数:
exchange
- the current exchange