1 Reply Latest reply on Dec 9, 2008 5:51 AM by Chua Khoon Yong

    Session - setMaxInactiveInterval : how to get it work?

    Chua Khoon Yong Novice

      Greetings,

      I was developing some apps on JBOSS portal, and there are some cases that need to have a much longer session timeout value that the default value in web.xml.

      So, i go about trying to change the session timeout value using setMaxInactiveInterval(). But i notice that the effective session timeout is still the original default value in web.xml in my deployed apps.


      The 2 sets of not working code that i had tried are as follows:

      int regularSessionTimeout = ServletContexts.getInstance().getRequest().getSession().getMaxInactiveInterval();
      log.info("MaxInactiveInterval = " + regularSessionTimeout);
      ServletContexts.getInstance().getRequest().getSession().setMaxInactiveInterval(12000);
      


      HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
      log.info("MaxInactiveInterval = " + session.getMaxInactiveInterval());
      session.setMaxInactiveInterval(12000);
      


      From the logging, it shows that the session timeout was changed to the new value, but the session still effectively timeout at the old timeout value.

      My old value was 1200 seconds (20 minutes)
      New value is 12000 seconds.


      Any advise would be most appreciated.

      My system settings are:

      - Jboss Portal 2.6.5
      - Richfaces 3.2.2
      - Seam 2.1.0SP1

      Thank you.