Top Description Fields Constructors Methods
org.springframework.web.server.session

public Class DefaultWebSessionManager

extends Object
implements WebSessionManager
Class Inheritance
All Implemented Interfaces
org.springframework.web.server.session.WebSessionManager
Imports
java.util.List, org.apache.commons.logging.Log, .LogFactory, reactor.core.publisher.Flux, .Mono, org.springframework.util.Assert, org.springframework.web.server.ServerWebExchange, .WebSession

Default implementation of WebSessionManager delegating to a WebSessionIdResolver for session id resolution and to a WebSessionStore.
Authors
Rossen Stoyanchev, Rob Winch
Since
5.0

Field Summary

Modifier and TypeField and Description
private static final Log
private WebSessionIdResolver
private WebSessionStore

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private Mono<WebSession>
public Mono<WebSession>
getSession(ServerWebExchange
the current exchange
exchange
)

Implements org.springframework.web.server.session.WebSessionManager.getSession.

Return the WebSession for the given exchange.

public WebSessionIdResolver
public WebSessionStore
getSessionStore()

Return the configured WebSessionStore.

private Mono<WebSession>
private Mono<Void>
save(ServerWebExchange exchange, WebSession session)

public void
setSessionIdResolver(WebSessionIdResolver
the resolver to use
sessionIdResolver
)

Configure the id resolution strategy.

public void
setSessionStore(WebSessionStore
the persistence strategy to use
sessionStore
)

Configure the persistence strategy.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
private static final Log logger
sessionIdResolverback to summary
private WebSessionIdResolver sessionIdResolver
sessionStoreback to summary
private WebSessionStore sessionStore

Constructor Detail

DefaultWebSessionManagerback to summary
public DefaultWebSessionManager()

Method Detail

createWebSessionback to summary
private Mono<WebSession> createWebSession()
getSessionback to summary
public Mono<WebSession> getSession(ServerWebExchange exchange)

Implements org.springframework.web.server.session.WebSessionManager.getSession.

Doc from org.springframework.web.server.session.WebSessionManager.getSession.

Return the WebSession for the given exchange. Always guaranteed to return an instance either matching to the session id requested by the client, or a new session either because the client did not specify one or because the underlying session expired.

Parameters
exchange:ServerWebExchange

the current exchange

Returns:Mono<WebSession>

promise for the WebSession

Annotations
@Override
getSessionIdResolverback to summary
public WebSessionIdResolver getSessionIdResolver()

Return the configured WebSessionIdResolver.

getSessionStoreback to summary
public WebSessionStore getSessionStore()

Return the configured WebSessionStore.

retrieveSessionback to summary
private Mono<WebSession> retrieveSession(ServerWebExchange exchange)
saveback to summary
private Mono<Void> save(ServerWebExchange exchange, WebSession session)
setSessionIdResolverback to summary
public void setSessionIdResolver(WebSessionIdResolver sessionIdResolver)

Configure the id resolution strategy.

By default an instance of CookieWebSessionIdResolver.

Parameters
sessionIdResolver:WebSessionIdResolver

the resolver to use

setSessionStoreback to summary
public void setSessionStore(WebSessionStore sessionStore)

Configure the persistence strategy.

By default an instance of InMemoryWebSessionStore.

Parameters
sessionStore:WebSessionStore

the persistence strategy to use