Httpsession does not expire when Ajax is enabled

I have a web application that uses DWR reverse Ajax (pollAndCometEnabled is set to true) In my web.xml, I have set a timeout of 30 minutes for the HttpSession. Since DWR is polling the server, the http session is always active and the result is that it never expires, even if the user interaction is inactive for more than 30 minutes. Does anyone know how to fix this problem?

+2


source to share


1 answer


I can think of three different options for you ...

1) keep your comet requests on a domain that doesn't use session cookies; as a side benefit, you will also reduce your overhead



2) track timeout on the client side. depending on your application setup, this might be a little more difficult, but setTimeout is an incredibly simple solution. The downside is that you don't actually end them, so the session is technically still valid for the server, but at the top you can easily give them a nice warning that your session is about to expire.

3) Monitoring of activity from the server; since you are using comet solution you can keep track of sessions on the server and when the session expires push a message to the client notifying it when the session ends. This is the best option if you cannot switch domains because you can delete the session on the server and report to the client at the same time.

0


source







All Articles