title: Why is my (Spring Security) servlet filter getting called twice?
body: <p>Any ideas about why doFilterHttp in my SpringSecurityFilter subclass is getting called twice on each request? I don't really know where to start looking. Feeling a little stumped.</p>
  
  <p>I'm reverse engineering a vacationing co-worker's code. To the best I can figure it, here's the relevant configuration:</p>
  
  <p>in web.xml:</p>
  
  <pre><code>&lt;filter&gt;
      &lt;filter-name&gt;userSecurityFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;org.springframework.web.filter.DelegatingFilterProxy&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;userSecurityFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;*.do&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  &lt;filter-mapping&gt;
  &lt;filter-name&gt;userSecurityFilter&lt;/filter-name&gt;
  &lt;url-pattern&gt;/json/*&lt;/url-pattern&gt;
  </code></pre>
  
  <p></p>
  
  <p>In spring-security.xml:</p>
  
  <pre><code> &lt;!-- Create the filter chains for developers, users and services --&gt;
   &lt;bean id="userSecurityFilter" class="org.springframework.security.util.FilterChainProxy"&gt;
    &lt;security:filter-chain-map path-type="ant"&gt;
       &lt;security:filter-chain pattern="/**/json/*"     filters="AuthFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor"/&gt;
       &lt;security:filter-chain pattern="/**/*.do"       filters="AuthFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor"/&gt;
       &lt;security:filter-chain pattern="/**"            filters="anonymousProcessingFilter,logoutFilter,exceptionTranslationFilter,filterInvocationInterceptor"/&gt;
    &lt;/security:filter-chain-map&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>It looks like the /**/json/* urls are getting the filter chain applied twice, while others only get it once. I'm going to go back and check to make sure what I just said is really true.</p>