Spring security, DWR and session time out

In AJAX applications, using Spring security, handling session time out is a bit tricky. The problem is summarized here. Fortunately with DWR it is easy. DWR provides a way to handle errors, exceptions etc globally. Check ┬ámore on this here . As mentioned in the doc, you can use ‘textHtmlHandler’ to handle session time out. Here is the snippet,

dwr.engine.setTextHtmlHandler(function() {

//If the current page is secure, Spring security redirects you to login page
//Or you can set the document.location to your login page.