Domanda

I have a Java Servlet app with session tracking mechanism using HTTPSessionListener. Front end script of my app periodically makes ajax calls to the server after 10 seconds. I have set session timeout to 1 minute.

Session timeout doesn't seem to honor the ajax requests. The session gets destroyed after a minute. How can I prevent this?

I have set the timeout using:

<session-config>
        <session-timeout>1</session-timeout>
</session-config>

When actually a session timeout occurs?

È stato utile?

Soluzione

Test your application with a tool like Firebug's Net monitor (http://getfirebug.com/network).

Using the monitor you can:

1) Ensure that the ajax calls are in fact being sent to the server every 10 seconds.

2) Ensure that the ajax calls are not being cached on the client side. One way to avoid client-side caching is by appending something random to the end of the URL e.g. ?nanotime=38283471283917.

Good luck with your debugging.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top