javavert.xvertx-verticle

How to change the default session timeout in Vert.x (java)


We want to change the default session timeout in Vert.x. After searching in the documentation I've found that sessions use this variable to define timeout value:

public static final long DEFAULT_SESSION_TIMEOUT = 1800000L

This variable is stored in the class io.vertx.ext.web.handler.SessionHandler (Vert.x Web) but we can't find the way or the method to change this value from 30 min to 60 min.

So, how can i change the default session timeout ?

Thanks


Solution

  • long TIMEOUT_IN_MS = 3600000L;
    
    router.route()
      .handler(SessionHandler.create(store).setSessionTimeout(TIMEOUT_IN_MS));
    

    See "Handling Session" in the Vert.x Web documentation for more details.