users@glassfish.java.net

Re: Cache-Control headers

From: steliyan georgiev <steliyanpgeorgiev_at_gmail.com>
Date: Thu, 24 Mar 2011 01:02:43 +0200

Hi,

I guess this question is more for the users mailgroup than the dev one so I
am redirecting it there.

First thing that comes to my mind is try to set the project stage to
production in your web.xml

<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
</context-param>

If this doesn't help you can try developing a filter which overrides these
headers and sets them to null

public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain) throws IOException, ServletException {
               chain.doFilter(request, response);
               HttpServletResponse httpServletResponse =
(HttpServletResponse)response;
               httpServletResponse.setHeader("Cache-Control", null);
               httpServletResponse.setHeader("Pragme", null);


       }

I suppose you would like to map this filter only to static resources.


On Wed, Mar 23, 2011 at 8:40 PM, Derek Knapp <derek_at_itracmedia.com> wrote:

> I have a JSF 2.0 application, but IE is not caching my resources (firefox
> does)
>
> I look at the response headers and I can see
>
> Pragma: No-cache
> Cache-Control: no-cache
>
> is there any way to get rid of these headers??
>
>
> Cheers,
> Derek Knapp
>
>