We have a stateful app. When a user is inactive for some time, the session times out, and cached data/objects are destroyed.
We have a request filter which checks the session before the request is processed. If the session is null we return a redirect to the login page. This works fine for normal, non-XHR requests.
But how should we deal with XHR requests? As far as I understand issuing a redirect to an XHR request will simply mean that the login page html is returned in response to the XHR request, which obviously is not the desired behaviour!
How can we issue an actual page redirect in this instance? If this is not possible, what alternatives are there? I imagine many apps must have to deal with this.
Edit: I should also mention that due to the use of an app framework which handles a lot of our ajax stuff we can't easily add checks to the ajax response.