Interface SessionStore


  • public interface SessionStore
    To store data in session.
    Since:
    1.8.1
    Author:
    Jerome Leleu
    • Method Detail

      • getSessionId

        java.util.Optional<java.lang.String> getSessionId​(WebContext context,
                                                          boolean createSession)
        Get or create the session identifier and initialize the session with it if necessary.
        Parameters:
        context - the web context
        Returns:
        the optional session identifier
      • get

        java.util.Optional<java.lang.Object> get​(WebContext context,
                                                 java.lang.String key)
        Get the object from its key in store.
        Parameters:
        context - the web context
        key - the key of the object
        Returns:
        the optional object in store
      • set

        void set​(WebContext context,
                 java.lang.String key,
                 java.lang.Object value)
        Save an object in the store by its key.
        Parameters:
        context - the web context
        key - the key of the object
        value - the value to save in store
      • destroySession

        boolean destroySession​(WebContext context)
        Destroy the web session.
        Parameters:
        context - the web context
        Returns:
        whether the session has been destroyed
      • getTrackableSession

        java.util.Optional<java.lang.Object> getTrackableSession​(WebContext context)
        Get the native session as a trackable object.
        Parameters:
        context - the web context
        Returns:
        the optional trackable object
      • buildFromTrackableSession

        java.util.Optional<SessionStore> buildFromTrackableSession​(WebContext context,
                                                                   java.lang.Object trackableSession)
        Build a new session store from a trackable session.
        Parameters:
        context - the web context
        trackableSession - the trackable session
        Returns:
        the optional new session store
      • renewSession

        boolean renewSession​(WebContext context)
        Renew the native session by copying all data to a new one.
        Parameters:
        context - the web context
        Returns:
        whether the session store has renewed the session