title: Liferay: Customise the web.xml HeaderFilter added during portlet deployment
body: <p>I need to customise the deployment of my liferay portlet such that the GWT nocache.js files don't get a 'Expires' HTTP header set. </p>
  
  <p>My war file looks like this:</p>
  
  <pre><code>view.jsp
  com.foobar.MyEntryPoint/com.foobar.MyEntryPoint.nocache.js
  com.foobar.MyEntryPoint/12312312313213123123123.cache.html
  WEB-INF/web.xml
  WEB-INF/portlet.xml
  WEB-INF/liferay-portlet.xml
  ... etc
  </code></pre>
  
  <p>my <code>web.xml</code> is pretty much empty (only has the displayName)</p>
  
  <p>On deployment this is rewritten my liferay to have a series of filters in particalar:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;filter&gt;
      &lt;filter-name&gt;Header Filter&lt;/filter-name&gt;
      &lt;filter-class&gt;com.liferay.portal.kernel.servlet.PortalClassLoaderFilter&lt;/filter-class&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;filter-class&lt;/param-name&gt;
          &lt;param-value&gt;com.liferay.portal.servlet.filters.header.HeaderFilter&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;Cache-Control&lt;/param-name&gt;
          &lt;param-value&gt;max-age=315360000, public&lt;/param-value&gt;
      &lt;/init-param&gt;
      &lt;init-param&gt;
          &lt;param-name&gt;Expires&lt;/param-name&gt;
          &lt;param-value&gt;315360000&lt;/param-value&gt;
      &lt;/init-param&gt;
  &lt;/filter&gt;
  &lt;filter-mapping&gt;
  &lt;filter-name&gt;Header Filter&lt;/filter-name&gt;
      &lt;url-pattern&gt;*.js&lt;/url-pattern&gt;
  &lt;/filter-mapping&gt;
  </code></pre>
  
  <p>This filter adds an Expires header for about 2020 to the .nocache.js js files... the trouble is these files really shouldn't be cached (the hint is in the name :)</p>
  
  <p>For development purposes I have worked around this by disabling the filter using:</p>
  
  <pre><code>com.liferay.portal.servlet.filters.header.HeaderFilter=false
  </code></pre>
  
  <p>in portal-ext.properties globaly. What I what I would like to to is one of the following:</p>
  
  <ul>
  <li>Disable HeaderFilter only for this portlet or war file. I can always add my own expires</li>
  <li>Add an init-param to the HeaderFilter to match anything other than .nocache.js files</li>
  </ul>
  
  <p>Any ideas how either of these things could be achieved?</p>
  
  <p>Stack: liferay-6.0.1 CE, Windows 7, java 1.6.0_18, GWT 2.0.3</p>