Package io.vertx.rxjava3.ext.web

## Class Session

- java.lang.Object
- - io.vertx.rxjava3.ext.web.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 RX-ified interface using Vert.x codegen.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static io.vertx.lang.rx.TypeArg<Session>` | `__TYPE_ARG` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Session​(Session delegate)` |
    `Session​(Object delegate)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Session` | `computeIfAbsent​(String key, java.util.function.Function<String,​Object> mappingFunction)` | Put some data in a session if absent.
    `Map<String,​Object>` | `data()` |
    `void` | `destroy()` | Destroy the session
    `boolean` | `equals​(Object o)` |
    `<T> T` | `get​(String key)` | Get some data from the session
    `Session` | `getDelegate()` |
    `int` | `hashCode()` |
    `String` | `id()` |
    `boolean` | `isDestroyed()` |
    `boolean` | `isEmpty()` |
    `boolean` | `isRegenerated()` |
    `long` | `lastAccessed()` |
    `static Session` | `newInstance​(Session arg)` |
    `String` | `oldId()` |
    `Session` | `put​(String key, Object obj)` | Put some data in a session
    `Session` | `putIfAbsent​(String key, Object obj)` | Put some data in a session if absent
    `Session` | `regenerateId()` |
    `<T> T` | `remove​(String key)` | Remove some data from the session
    `void` | `setAccessed()` | Mark the session as being accessed.
    `long` | `timeout()` |
    `String` | `toString()` |
    `String` | `value()` | The short representation of the session to be added to the session cookie.

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### __TYPE_ARG

          public static final io.vertx.lang.rx.TypeArg<Session> __TYPE_ARG

  - ### Constructor Detail

    - #### Session

          public Session​(Session delegate)

    - #### Session

          public Session​(Object delegate)

  - ### Method Detail

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### equals

          public boolean equals​(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getDelegate

          public Session getDelegate()

    - #### 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)

      Put some data in a session
      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)

      Put some data in a session if absent
      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,
                                         java.util.function.Function<String,​Object> mappingFunction)

      Put some data in a session if absent. If the specified key is not already associated with a value (or is mapped to `null`), attempts to compute its value using the given mapping function and enters it into this map unless `null`.
      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)

      Get some data from the session
      Parameters:
        `key` - the key of the data
      Returns:
        the data

    - #### remove

          public <T> T remove​(String key)

      Remove some data from the session
      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()

      Destroy the session

    - #### 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()

      Mark the session as being accessed.

    - #### value

          public String value()

      The short representation of the session to be added to the session cookie. By default is the session id.
      Returns:
        short representation string.

    - #### data

          public Map<String,​Object> data()

      Returns:
        the session data as a map

    - #### newInstance

          public static Session newInstance​(Session arg)