title: Java servlet filter not working on login
body: <p>I've written a filter class to add a P3P header to every page.  I added this to my web.xml:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;filter&gt;
      &lt;filter-name&gt;AddP3pHeaderFilter&lt;/filter-name&gt;
      &lt;filter-class&gt;com.mycompany.AddP3pHeaderFilter&lt;/filter-class&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
      &lt;filter-name&gt;AddP3pHeaderFilter&lt;/filter-name&gt;
      &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>It adds the header to every page request, but it doesn't work when the user first logs in.  The user submits the form to <code>j_security_check</code>, but the response doesn't include the header.  How can I make my filter apply to the login request?</p>