title: Session Timeout AJAX Error in Tapestry Application
body: <p>I'm building a webapp using Tapestry in combination with Spring Security and the jQuery-library besides Prototype. When a user clicks on a link after his session timed out, he is automatically redirected to the login page. This, of course, does not work for links, that trigger an AJAX-request.</p>
  
  <p>I know, this is a common problem with any kind of web application (e.g. <a href="http://www.openjs.com/articles/ajax/session_timeout.php" rel="noreferrer">http://www.openjs.com/articles/ajax/session_timeout.php</a>). Is there a best practice solution for Tapestry 5?</p>
  
  <p><strong>EDIT</strong>
  The following solution (thanks to Henning) works for me:</p>
  
  <pre>Ajax.Responders.register(
  {
      onException: function()
      {
          window.location.reload();
      }
  });
  </pre>
  
  <p>In case of a failure during an AJAX-call a page reload is triggered, which in result redirects to the login-page. It still needs some tuning (e.g. display an error message instead of redirect), but using <code>Ajax.Responders</code> basically seems a good way to do it.</p>