Class SessionStore

  • Direct Known Subclasses:
    ClusteredSessionStore, LocalSessionStore

    public class SessionStore
    extends Object
    A session store is used to store sessions for an Vert.x-Web web app

    NOTE: This class has been automatically generated from the original non Mutiny-ified interface using Vert.x codegen.

    • Field Detail

      • DEFAULT_SESSIONID_LENGTH

        public static final int DEFAULT_SESSIONID_LENGTH
        Default length for a session id. More info: https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
        See Also:
        Constant Field Values
    • Constructor Detail

      • SessionStore

        public SessionStore​(io.vertx.ext.web.sstore.SessionStore delegate)
      • SessionStore

        public SessionStore​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.web.sstore.SessionStore getDelegate()
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • create

        public static SessionStore create​(Vertx vertx)
        Parameters:
        vertx - vertx instance
        Returns:
        the store or runtime exception
      • create

        public static SessionStore create​(Vertx vertx,
                                          io.vertx.core.json.JsonObject options)
        Parameters:
        vertx - vertx instance
        options - extra options for initialization
        Returns:
        the store or runtime exception
      • init

        public SessionStore init​(Vertx vertx,
                                 io.vertx.core.json.JsonObject options)
        Parameters:
        vertx - the vertx instance
        options - optional Json with extra configuration options
        Returns:
        self
      • retryTimeout

        public long retryTimeout()
        Returns:
        the timeout value, in ms
      • createSession

        public Session createSession​(long timeout)
        Parameters:
        timeout - - the session timeout, in ms
        Returns:
        the session
      • createSession

        public Session createSession​(long timeout,
                                     int length)
        Parameters:
        timeout - - the session timeout, in ms
        length - - the required length for the session id
        Returns:
        the session
      • get

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Session> get​(String cookieValue)
        Get the session with the specified ID.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        cookieValue - the unique ID of the session
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • getAndAwait

        public Session getAndAwait​(String cookieValue)
        Blocking variant of get(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        cookieValue - the unique ID of the session
        Returns:
        the Session instance produced by the operation.
      • getAndForget

        public SessionStore getAndForget​(String cookieValue)
        Variant of get(String) that ignores the result of the operation.

        This method subscribes on the result of get(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from get(String) but you don't need to compose it with other operations.

        Parameters:
        cookieValue - the unique ID of the session
        Returns:
        the instance of SessionStore to chain method calls.
      • delete

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> delete​(String id)
        Delete the session with the specified ID.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        id - the session id
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • deleteAndAwait

        public Void deleteAndAwait​(String id)
        Blocking variant of delete(String).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        id - the session id
        Returns:
        the Void instance produced by the operation.
      • deleteAndForget

        public SessionStore deleteAndForget​(String id)
        Variant of delete(String) that ignores the result of the operation.

        This method subscribes on the result of delete(String), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from delete(String) but you don't need to compose it with other operations.

        Parameters:
        id - the session id
        Returns:
        the instance of SessionStore to chain method calls.
      • put

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> put​(Session session)
        Add a session with the specified ID.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Parameters:
        session - the session
        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • putAndAwait

        public Void putAndAwait​(Session session)
        Blocking variant of put(io.vertx.mutiny.ext.web.Session).

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Parameters:
        session - the session
        Returns:
        the Void instance produced by the operation.
      • clear

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Void> clear()
        Remove all sessions from the store.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • clearAndAwait

        public Void clearAndAwait()
        Blocking variant of clear().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Void instance produced by the operation.
      • clearAndForget

        public SessionStore clearAndForget()
        Variant of clear() that ignores the result of the operation.

        This method subscribes on the result of clear(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from clear() but you don't need to compose it with other operations.

        Returns:
        the instance of SessionStore to chain method calls.
      • size

        @CheckReturnValue
        public io.smallrye.mutiny.Uni<Integer> size()
        Get the number of sessions in the store.

        Beware of the result which is just an estimate, in particular with distributed session stores.

        Unlike the bare Vert.x variant, this method returns a Uni. Don't forget to subscribe on it to trigger the operation.

        Returns:
        the uni firing the result of the operation when completed, or a failure if the operation failed.
      • sizeAndAwait

        public Integer sizeAndAwait()
        Blocking variant of size().

        This method waits for the completion of the underlying asynchronous operation. If the operation completes successfully, the result is returned, otherwise the failure is thrown (potentially wrapped in a RuntimeException).

        Returns:
        the Integer instance produced by the operation.
      • sizeAndForget

        public SessionStore sizeAndForget()
        Variant of size() that ignores the result of the operation.

        This method subscribes on the result of size(), but discards the outcome (item or failure). This method is useful to trigger the asynchronous operation from size() but you don't need to compose it with other operations.

        Returns:
        the instance of SessionStore to chain method calls.
      • close

        public void close()
      • newInstance

        public static SessionStore newInstance​(io.vertx.ext.web.sstore.SessionStore arg)