Search code examples
javajakarta-eewebspheresession-timeoutwebsphere-7

Getting session timeout value from WebSphere Application Server using Java


Is it possible to get session timeout value set in WebSphere Application Server from Java code dynamically?

I need to show an alert 5 minutes before the actual session expires. Please suggest.

Thanks


Solution

  • You can get the session timeout with the funcion getMaxInactiveInterval().You can also get the timestamp of session creation using a Listener that stores that value on a Session scoped variable. If you query both values from the browser, you can activate a timer that solves your problem.

    For the timeout: http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpSession.html

    For the listener (watch SessionLifeCycleEventExample): http://docs.oracle.com/cd/B14099_19/web.1012/b14017/filters.htm