Class CookieWebSessionIdResolver
java.lang.Object
org.springframework.web.server.session.CookieWebSessionIdResolver
- All Implemented Interfaces:
- WebSessionIdResolver
Cookie-based 
WebSessionIdResolver.- Since:
- 5.0
- Author:
- Rossen Stoyanchev, Brian Clozel
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddCookieInitializer(Consumer<ResponseCookie.ResponseCookieBuilder> initializer) Add aConsumerto further initialize the session id cookie aftergetCookieName()andgetCookieMaxAge()are applied.voidexpireSession(ServerWebExchange exchange) Instruct the client to end the current session.Get the configured "Max-Age" for the session id cookie.Get the configured cookie name.resolveSessionIds(ServerWebExchange exchange) Resolve the session IDs associated with the request.voidsetCookieMaxAge(Duration maxAge) Set the "Max-Age" attribute for the session id cookie.voidsetCookieName(String cookieName) Set the name for the session id cookie.voidsetSessionId(ServerWebExchange exchange, String id) Send the given session ID to the client.
- 
Constructor Details- 
CookieWebSessionIdResolverpublic CookieWebSessionIdResolver()
 
- 
- 
Method Details- 
setCookieNameSet the name for the session id cookie.By default set to "SESSION". - Parameters:
- cookieName- the cookie name
 
- 
getCookieNameGet the configured cookie name.
- 
setCookieMaxAgeSet the "Max-Age" attribute for the session id cookie.By default set to -1 in which case the cookie is removed when the browser is closed. - Parameters:
- maxAge- the maxAge duration value
- See Also:
 
- 
getCookieMaxAgeGet the configured "Max-Age" for the session id cookie.
- 
addCookieInitializerAdd aConsumerto further initialize the session id cookie aftergetCookieName()andgetCookieMaxAge()are applied.- Parameters:
- initializer- consumer to initialize the cookie with
- Since:
- 5.1
 
- 
resolveSessionIdsDescription copied from interface:WebSessionIdResolverResolve the session IDs associated with the request.- Specified by:
- resolveSessionIdsin interface- WebSessionIdResolver
- Parameters:
- exchange- the current exchange
- Returns:
- the session IDs or an empty list
 
- 
setSessionIdDescription copied from interface:WebSessionIdResolverSend the given session ID to the client.- Specified by:
- setSessionIdin interface- WebSessionIdResolver
- Parameters:
- exchange- the current exchange
- id- the session ID
 
- 
expireSessionDescription copied from interface:WebSessionIdResolverInstruct the client to end the current session.- Specified by:
- expireSessionin interface- WebSessionIdResolver
- Parameters:
- exchange- the current exchange
 
 
-