类 MockWebSession

  • 所有已实现的接口:
    WebSession

    public class MockWebSession
    extends Object
    implements WebSession
    Implementation of 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.

    从以下版本开始:
    5.1
    作者:
    Rossen Stoyanchev
    • 方法详细资料

      • changeSessionId

        public reactor.core.publisher.Mono<VoidchangeSessionId()
        从接口复制的说明: WebSession
        Generate a new id for the session and update the underlying session storage to reflect the new id. After a successful call WebSession.getId() reflects the new session id.
        指定者:
        changeSessionId 在接口中 WebSession
        返回:
        completion notification (success or error)
      • invalidate

        public reactor.core.publisher.Mono<Voidinvalidate()
        从接口复制的说明: WebSession
        Invalidate the current session and clear session storage.
        指定者:
        invalidate 在接口中 WebSession
        返回:
        completion notification (success or error)
      • save

        public reactor.core.publisher.Mono<Voidsave()
        从接口复制的说明: WebSession
        Save the session through the WebSessionStore as follows:
        • If the session is new (i.e. created but never persisted), it must have been started explicitly via WebSession.start() or implicitly by adding attributes, or otherwise this method should have no effect.
        • If the session was retrieved through the WebSessionStore, the implementation for this method must check whether the session was invalidated and if so return an error.

        Note that this method is not intended for direct use by applications. Instead it is automatically invoked just before the response is committed.

        指定者:
        save 在接口中 WebSession
        返回:
        Mono to indicate completion with success or error
      • isExpired

        public boolean isExpired()
        从接口复制的说明: WebSession
        Return true if the session expired after maxIdleTime elapsed.

        Typically expiration checks should be automatically made when a session is accessed, a new WebSession instance created if necessary, at the start of request processing so that applications don't have to worry about expired session by default.

        指定者:
        isExpired 在接口中 WebSession