Package org.springframework.web.server.session

# Class DefaultWebSessionManager

java.lang.Object
org.springframework.web.server.session.DefaultWebSessionManager

All Implemented Interfaces:
  `WebSessionManager`

public class DefaultWebSessionManager extends Object implements WebSessionManager
Default implementation of `WebSessionManager` delegating to a `WebSessionIdResolver` for session id resolution and to a `WebSessionStore`.

Since:
  5.0
Author:
  Rossen Stoyanchev, Rob Winch

## Constructor Summary

Constructors
Constructor
Description
`DefaultWebSessionManager()`

## Method Summary

Modifier and Type
Method
Description
`reactor.core.publisher.Mono<WebSession>`
`getSession(ServerWebExchange exchange)`
Return the `WebSession` for the given exchange.
`WebSessionIdResolver`
`getSessionIdResolver()`
Return the configured `WebSessionIdResolver`.
`WebSessionStore`
`getSessionStore()`
Return the configured `WebSessionStore`.
`void`
`setSessionIdResolver(WebSessionIdResolver sessionIdResolver)`
Configure the id resolution strategy.
`void`
`setSessionStore(WebSessionStore sessionStore)`
Configure the persistence strategy.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DefaultWebSessionManager

public DefaultWebSessionManager()

## Method Details

### setSessionIdResolver

public void setSessionIdResolver(WebSessionIdResolver sessionIdResolver)
Configure the id resolution strategy.

By default an instance of `CookieWebSessionIdResolver`.

Parameters:
  `sessionIdResolver` - the resolver to use

### getSessionIdResolver

public WebSessionIdResolver getSessionIdResolver()
Return the configured `WebSessionIdResolver`.

### setSessionStore

public void setSessionStore(WebSessionStore sessionStore)
Configure the persistence strategy.

By default an instance of `InMemoryWebSessionStore`.

Parameters:
  `sessionStore` - the persistence strategy to use

### getSessionStore

public WebSessionStore getSessionStore()
Return the configured `WebSessionStore`.

### getSession

public reactor.core.publisher.Mono<WebSession> getSession(ServerWebExchange exchange)
Description copied from interface: `WebSessionManager`
Return the `WebSession` for the given exchange.

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

Specified by:
  `getSession` in interface `WebSessionManager`
Parameters:
  `exchange` - the current exchange
Returns:
  promise for the WebSession