Class Session


  • public class Session
    extends Object
    Represents a browser session.

    Sessions persist between HTTP requests for a single browser session. They are deleted when the browser is closed, or they time-out. Session cookies are used to maintain sessions using a secure UUID.

    Sessions can be used to maintain data for a browser session, e.g. a shopping basket.

    The context must have first been routed to a SessionHandler for sessions to be available.

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

    • Constructor Detail

      • Session

        public Session​(io.vertx.ext.web.Session delegate)
      • Session

        public Session​(Object delegate)
    • Method Detail

      • getDelegate

        public io.vertx.ext.web.Session getDelegate()
      • hashCode

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

        public Session regenerateId()
        Returns:
        The new unique ID of the session.
      • id

        public String id()
        Returns:
        The unique ID of the session. This is generated using a random secure UUID.
      • put

        public Session put​(String key,
                           Object obj)
        Parameters:
        key - the key for the data
        obj - the data
        Returns:
        a reference to this, so the API can be used fluently
      • putIfAbsent

        public Session putIfAbsent​(String key,
                                   Object obj)
        Parameters:
        key - the key for the data
        obj - the data
        Returns:
        a reference to this, so the API can be used fluently
      • computeIfAbsent

        public Session computeIfAbsent​(String key,
                                       Function<String,​Object> mappingFunction)
        Parameters:
        key - the key for the data
        mappingFunction - a mapping function
        Returns:
        a reference to this, so the API can be used fluently
      • get

        public <T> T get​(String key)
        Parameters:
        key - the key of the data
        Returns:
        the data
      • remove

        public <T> T remove​(String key)
        Parameters:
        key - the key of the data
        Returns:
        the data that was there or null if none there
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if the session has data
      • lastAccessed

        public long lastAccessed()
        Returns:
        the time the session was last accessed
      • destroy

        public void destroy()
      • isDestroyed

        public boolean isDestroyed()
        Returns:
        has the session been destroyed?
      • isRegenerated

        public boolean isRegenerated()
        Returns:
        has the session been renewed?
      • oldId

        public String oldId()
        Returns:
        old ID if renewed
      • timeout

        public long timeout()
        Returns:
        the amount of time in ms, after which the session will expire, if not accessed.
      • setAccessed

        public void setAccessed()
      • value

        public String value()
        Returns:
        short representation string.
      • data

        public Map<String,​Object> data()
        Returns:
        the session data as a map
      • newInstance

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