title: Spring security Session Timeout handling for Ajax calls
body: <p>I have create webapp where I have used Spring Security and I have added 2 custom filters to <em>spring-security.xml</em> file shown below. </p>
  
  <pre><code>    &lt;security:custom-filter ref="authenticationFilter" position="FORM_LOGIN_FILTER"/&gt;
      &lt;security:custom-filter ref="concurrencyFilter" position="CONCURRENT_SESSION_FILTER"/&gt;
  </code></pre>
  
  <p>It works for non ajax requests. When I try to send AJAX request while session is already expired action returns me login page as html which as response is loaded into the div element.
  I have already searched for solution and found this link <a href="http://doanduyhai.wordpress.com/2012/04/21/spring-security-part-vi-session-timeout-handling-for-ajax-calls/" rel="nofollow noreferrer">Session Timeout handling for Ajax calls</a> where defined functionality returns status code and this code used in javascript side in order to navigate user to login page.</p>
  
  <p><strong>My question is:</strong></p>
  
  <p>In which order <strong>authenticationFilter</strong>, <strong>concurrencyFilter</strong> and <strong>ajaxTimeoutRedirectFilter</strong> have to be defined in <em>spring-security.xml</em> file to make request pipeline correctly to be handled?</p>