0

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?

aBhijit
  • 5,261
  • 10
  • 36
  • 56

1 Answers1

1

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.

mikey
  • 5,090
  • 3
  • 24
  • 27
  • 1
    I found the problem. It was a silly mistake at my end. I was testing my app on localhost. However, ajax requests were made to my IP address. Session information of localhost and IP address is maintained separately. So my localhost session was not getting reset. Thanks. – aBhijit Sep 30 '13 at 08:35