Class HeaderWebSessionIdResolver
- java.lang.Object
- org.springframework.web.server.session.HeaderWebSessionIdResolver
- All Implemented Interfaces:
WebSessionIdResolver
public class HeaderWebSessionIdResolver extends Object implements WebSessionIdResolver
Request and response header-basedWebSessionIdResolver
.- Since:
- 5.0
- Author:
- Greg Turnquist, Rob Winch
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_HEADER_NAME
Default value forsetHeaderName(String)
.
Constructor Summary
Constructors Constructor Description HeaderWebSessionIdResolver()
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
expireSession(ServerWebExchange exchange)
Instruct the client to end the current session.String
getHeaderName()
Return the configured header name.List<String>
resolveSessionIds(ServerWebExchange exchange)
Resolve the session id's associated with the request.void
setHeaderName(String headerName)
Set the name of the session header to use for the session id.void
setSessionId(ServerWebExchange exchange, String id)
Send the given session id to the client.
Field Detail
DEFAULT_HEADER_NAME
public static final String DEFAULT_HEADER_NAME
Default value forsetHeaderName(String)
.- See Also:
- Constant Field Values
Constructor Detail
HeaderWebSessionIdResolver
public HeaderWebSessionIdResolver()
Method Detail
setHeaderName
public void setHeaderName(String headerName)
Set the name of the session header to use for the session id. The name is used to extract the session id from the request headers as well to set the session id on the response headers.By default set to
DEFAULT_HEADER_NAME
- Parameters:
headerName
- the header name
getHeaderName
public String getHeaderName()
Return the configured header name.- Returns:
- the configured header name
resolveSessionIds
public List<String> resolveSessionIds(ServerWebExchange exchange)
Description copied from interface:WebSessionIdResolver
Resolve the session id's associated with the request.- Specified by:
resolveSessionIds
in interfaceWebSessionIdResolver
- Parameters:
exchange
- the current exchange- Returns:
- the session id's or an empty list
setSessionId
public void setSessionId(ServerWebExchange exchange, String id)
Description copied from interface:WebSessionIdResolver
Send the given session id to the client.- Specified by:
setSessionId
in interfaceWebSessionIdResolver
- Parameters:
exchange
- the current exchangeid
- the session id
expireSession
public void expireSession(ServerWebExchange exchange)
Description copied from interface:WebSessionIdResolver
Instruct the client to end the current session.- Specified by:
expireSession
in interfaceWebSessionIdResolver
- Parameters:
exchange
- the current exchange