Search code examples
javajettyhttpsession

Keep http session alive whilst use is on page


If call HttpSession.setMaxInactiveInterval() with 3600 - meaning an hour and have an AJAX script that hits my sever every 10 minutes, will that be sufficient?

I can't seem to find a reason way to see what sessions are expiring and why, otherwise I would have tested this myself.


Solution

  • You can provide this entry in web.xml. This will keep the web session alive for 1 hr.

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>