users@glassfish.java.net

Q: Can I define a Web Application with an indefinite session timeout in Glassfish 2.1?

From: Ed Hillmann <ed.hillmann_at_gmail.com>
Date: Thu, 10 Sep 2009 11:30:10 +1000

Hi all. I've got a web application running in v2.1 of Glassfish. I've been
asked to look into defining the http sessions for this web application as
indefinite. To date, our session-timeout element in web.xml has been set to
30.

So, I found this
<http://docs.sun.com/app/docs/doc/820-4337/beaxr?a=view>document that
describes the timeoutSeconds property that gets defined in the
sun-web.xml descriptor. However, whenever I

   1. set session-timeout in web.xml to 0, or
   2. set timeoutSeconds to 0 or -1 in sun-web.xml, removing the
   session-timeout element from the web.xml

My sessions are not kept at all. So, it's behaving quite the opposite of
what I'm expecting based on the documentation.

My sun-web.xml looks like

<sun-web-app error-url="">
    <session-config>
        <session-properties>
            <property name="timeoutSeconds" value="-1"/>
        </session-properties>
    </session-config>
</sun-web-app>

Am I doing this wrong? Or is this not implemented in GF 2.1, despite the
documentation?

Thanks for any help,
Ed