I am trying to implement a long polling mechanism for auto-updating a grid in a project that uses Spring MVC.
I am sending an Ajax request from the client and on the server side I enter a while loop until data is found then the data is send back as a response.
I need to have another mechanism that stops this operation (that breaks off the loop) when the user changes tab in the application (every tab has a different grid that is auto-updating through long polling. Every tab is handled server-side by a different controller).
What I thought is that I need to have a session scoped variable or bean that changes when the client changes tab and which is accessible from inside the loop so it can break on change. When I tried to use Spring MVC beans scope I noticed that the bean's property that I common in two different sessions (that is HttpSession). I tested this by loging in with a different user from the same machine.
I tried using the but I had the same result.
Any ideas on how to make this work?
Thank you in advance.