io.vertx.ext.web.handler

## Interface SessionHandler

- All Superinterfaces:
    Handler<RoutingContext>

      public interface SessionHandler
      extends 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 `RoutingContext.session()`.

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

  Author:
    Tim Fox

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `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 long` | `DEFAULT_SESSION_TIMEOUT` Default time, in ms, that a session lasts for without being accessed before expiring.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `static SessionHandler` | `create(SessionStore sessionStore)` Create a session handler
    `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` | `setSessionTimeout(long timeout)` Set the session timeout

    - ### Methods inherited from interface io.vertx.core.Handler

      `handle`

- - ### Field Detail

    - #### DEFAULT_SESSION_COOKIE_NAME

          static final String DEFAULT_SESSION_COOKIE_NAME

      Default name of session cookie
      See Also:
        Constant Field Values

    - #### DEFAULT_SESSION_TIMEOUT

          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

          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

  - ### Method Detail

    - #### create

          static SessionHandler create(SessionStore sessionStore)

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

    - #### setSessionTimeout

          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

          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

    - #### setSessionCookieName

          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

Copyright © 2015. All Rights Reserved.