io.vertx.reactivex.ext.web.handler

## Class SessionHandler

- java.lang.Object
- - io.vertx.reactivex.ext.web.handler.SessionHandler

- All Implemented Interfaces:
    Handler<RoutingContext>

      public class SessionHandler
      extends Object
      implements Handler<RoutingContext>

  A handler that maintains a `Session` for each browser session.

  It looks up the session for each request based on a session cookie which contains a session ID. It stores the session when the response is ended in the session store.

  The session is available on the routing context with .

  The session handler requires a `CookieHandler` to be on the routing chain before it.

  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 and Description
    --- | ---
    `static <any>` | `__TYPE_ARG`
    `static boolean` | `DEFAULT_COOKIE_HTTP_ONLY_FLAG` Default of whether the cookie has the HttpOnly flag set More info: https://www.owasp.org/index.php/HttpOnly
    `static boolean` | `DEFAULT_COOKIE_SECURE_FLAG` Default of whether the cookie has the 'secure' flag set to allow transmission over https only.
    `static boolean` | `DEFAULT_NAG_HTTPS` Default of whether a nagging log warning should be written if the session handler is accessed over HTTP, not HTTPS
    `static String` | `DEFAULT_SESSION_COOKIE_NAME` Default name of session cookie
    `static String` | `DEFAULT_SESSION_COOKIE_PATH` Default path of session cookie
    `static long` | `DEFAULT_SESSION_TIMEOUT` Default time, in ms, that a session lasts for without being accessed before expiring.
    `static int` | `DEFAULT_SESSIONID_MIN_LENGTH` Default min length for a session id.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SessionHandler(SessionHandler delegate)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SessionHandler` | `create(SessionStore sessionStore)` Create a session handler
    `boolean` | `equals(Object o)`
    `SessionHandler` | `getDelegate()`
    `void` | `handle(RoutingContext event)` Something has happened, so handle it.
    `int` | `hashCode()`
    `static SessionHandler` | `newInstance(SessionHandler arg)`
    `SessionHandler` | `setCookieHttpOnlyFlag(boolean httpOnly)` Sets whether the 'HttpOnly' flag should be set for the session cookie.
    `SessionHandler` | `setCookieSecureFlag(boolean secure)` Sets whether the 'secure' flag should be set for the session cookie.
    `SessionHandler` | `setMinLength(int minLength)` Set expected session id minimum length.
    `SessionHandler` | `setNagHttps(boolean nag)` Set whether a nagging log warning should be written if the session handler is accessed over HTTP, not HTTPS
    `SessionHandler` | `setSessionCookieName(String sessionCookieName)` Set the session cookie name
    `SessionHandler` | `setSessionCookiePath(String sessionCookiePath)` Set the session cookie path
    `SessionHandler` | `setSessionTimeout(long timeout)` Set the session timeout
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### __TYPE_ARG

          public static final <any> __TYPE_ARG

    - #### DEFAULT_SESSION_COOKIE_NAME

          public static final String DEFAULT_SESSION_COOKIE_NAME

      Default name of session cookie
      See Also:
        Constant Field Values

    - #### DEFAULT_SESSION_COOKIE_PATH

          public static final String DEFAULT_SESSION_COOKIE_PATH

      Default path of session cookie
      See Also:
        Constant Field Values

    - #### DEFAULT_SESSION_TIMEOUT

          public static final long DEFAULT_SESSION_TIMEOUT

      Default time, in ms, that a session lasts for without being accessed before expiring.
      See Also:
        Constant Field Values

    - #### DEFAULT_NAG_HTTPS

          public static final boolean DEFAULT_NAG_HTTPS

      Default of whether a nagging log warning should be written if the session handler is accessed over HTTP, not HTTPS
      See Also:
        Constant Field Values

    - #### DEFAULT_COOKIE_HTTP_ONLY_FLAG

          public static final boolean DEFAULT_COOKIE_HTTP_ONLY_FLAG

      Default of whether the cookie has the HttpOnly flag set More info: https://www.owasp.org/index.php/HttpOnly
      See Also:
        Constant Field Values

    - #### DEFAULT_COOKIE_SECURE_FLAG

          public static final boolean DEFAULT_COOKIE_SECURE_FLAG

      Default of whether the cookie has the 'secure' flag set to allow transmission over https only. More info: https://www.owasp.org/index.php/SecureFlag
      See Also:
        Constant Field Values

    - #### DEFAULT_SESSIONID_MIN_LENGTH

          public static final int DEFAULT_SESSIONID_MIN_LENGTH

      Default min length for a session id. More info: https://www.owasp.org/index.php/Session_Management_Cheat_Sheet
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SessionHandler

          public SessionHandler(SessionHandler 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 SessionHandler getDelegate()

    - #### handle

          public void handle(RoutingContext event)

      Something has happened, so handle it.
      Specified by:
        `handle` in interface `Handler<RoutingContext>`
      Parameters:
        `event` - the event to handle

    - #### create

          public static SessionHandler create(SessionStore sessionStore)

      Create a session handler
      Parameters:
        `sessionStore` - the session store
      Returns:
        the handler

    - #### setSessionTimeout

          public SessionHandler setSessionTimeout(long timeout)

      Set the session timeout
      Parameters:
        `timeout` - the timeout, in ms.
      Returns:
        a reference to this, so the API can be used fluently

    - #### setNagHttps

          public SessionHandler setNagHttps(boolean nag)

      Set whether a nagging log warning should be written if the session handler is accessed over HTTP, not HTTPS
      Parameters:
        `nag` - true to nag
      Returns:
        a reference to this, so the API can be used fluently

    - #### setCookieSecureFlag

          public SessionHandler setCookieSecureFlag(boolean secure)

      Sets whether the 'secure' flag should be set for the session cookie. When set this flag instructs browsers to only send the cookie over HTTPS. Note that this will probably stop your sessions working if used without HTTPS (e.g. in development).
      Parameters:
        `secure` - true to set the secure flag on the cookie
      Returns:
        a reference to this, so the API can be used fluently

    - #### setCookieHttpOnlyFlag

          public SessionHandler setCookieHttpOnlyFlag(boolean httpOnly)

      Sets whether the 'HttpOnly' flag should be set for the session cookie. When set this flag instructs browsers to prevent Javascript access to the the cookie. Used as a line of defence against the most common XSS attacks.
      Parameters:
        `httpOnly` - true to set the HttpOnly flag on the cookie
      Returns:
        a reference to this, so the API can be used fluently

    - #### setSessionCookieName

          public SessionHandler setSessionCookieName(String sessionCookieName)

      Set the session cookie name
      Parameters:
        `sessionCookieName` - the session cookie name
      Returns:
        a reference to this, so the API can be used fluently

    - #### setSessionCookiePath

          public SessionHandler setSessionCookiePath(String sessionCookiePath)

      Set the session cookie path
      Parameters:
        `sessionCookiePath` - the session cookie path
      Returns:
        a reference to this, so the API can be used fluently

    - #### setMinLength

          public SessionHandler setMinLength(int minLength)

      Set expected session id minimum length.
      Parameters:
        `minLength` - the session id minimal length
      Returns:
        a reference to this, so the API can be used fluently

    - #### newInstance

          public static SessionHandler newInstance(SessionHandler arg)

Copyright © 2018 Eclipse. All rights reserved.