public class MockWebSession extends Object implements org.springframework.web.server.WebSession
WebSession that delegates to a session instance
obtained via InMemoryWebSessionStore.
This is intended for use with the
session(WebSession)
method of the MockServerWebExchange builder, eliminating the need
to use WebSessionManager or WebSessionStore altogether.
| Constructor and Description |
|---|
MockWebSession() |
MockWebSession(Clock clock) |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.publisher.Mono<Void> |
changeSessionId() |
Map<String,Object> |
getAttributes() |
Instant |
getCreationTime() |
String |
getId() |
Instant |
getLastAccessTime() |
Duration |
getMaxIdleTime() |
reactor.core.publisher.Mono<Void> |
invalidate() |
boolean |
isExpired() |
boolean |
isStarted() |
reactor.core.publisher.Mono<Void> |
save() |
void |
setMaxIdleTime(Duration maxIdleTime) |
void |
start() |
public MockWebSession()
public MockWebSession(@Nullable
Clock clock)
public String getId()
getId in interface org.springframework.web.server.WebSessionpublic Map<String,Object> getAttributes()
getAttributes in interface org.springframework.web.server.WebSessionpublic void start()
start in interface org.springframework.web.server.WebSessionpublic boolean isStarted()
isStarted in interface org.springframework.web.server.WebSessionpublic reactor.core.publisher.Mono<Void> changeSessionId()
changeSessionId in interface org.springframework.web.server.WebSessionpublic reactor.core.publisher.Mono<Void> invalidate()
invalidate in interface org.springframework.web.server.WebSessionpublic reactor.core.publisher.Mono<Void> save()
save in interface org.springframework.web.server.WebSessionpublic boolean isExpired()
isExpired in interface org.springframework.web.server.WebSessionpublic Instant getCreationTime()
getCreationTime in interface org.springframework.web.server.WebSessionpublic Instant getLastAccessTime()
getLastAccessTime in interface org.springframework.web.server.WebSessionpublic void setMaxIdleTime(Duration maxIdleTime)
setMaxIdleTime in interface org.springframework.web.server.WebSessionpublic Duration getMaxIdleTime()
getMaxIdleTime in interface org.springframework.web.server.WebSession