Liferay: Customise the web.xml HeaderFilter added during portlet deloyment

Posted by gid on Stack Overflow See other posts from Stack Overflow or by gid
Published on 2010-05-07T14:42:29Z Indexed on 2010/05/07 14:48 UTC
Read the original article Hit count: 364

Filed under:
|
|

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.

My war file looks like this:

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

my web.xml is pretty much empty (only has the displayName)

On deployment this is rewritten my liferay to have a series of filters in particalar:

Header Filter com.liferay.portal.kernel.servlet.PortalClassLoaderFilter filter-class com.liferay.portal.servlet.filters.header.HeaderFilter Cache-Control max-age=315360000, public Expires 315360000 Header Filter *.js

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 :)

For development purposes I have worked around this by disabling the filter using:

com.liferay.portal.servlet.filters.header.HeaderFilter=false

in portal-ext.properties globaly. What I what I would like to to is one of the following:

  • Disable HeaderFilter only for this portlet or war file. I can always add my own expires
  • Add an init-param to the HeaderFilter to match anything other than .nocache.js files

Any ideas how either of these things could be achieved?

Stack: liferay-6.0.1 CE, Windows 7, java 1.6.0_18, GWT 2.0.3

© Stack Overflow or respective owner

Related posts about liferay

Related posts about java