users@glassfish.java.net

RE: Cache-Control headers

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Wed, 23 Mar 2011 20:32:42 -0400

agreed!

remember to "never break the chain"

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);
//call the next filter in the chain
               chain.doFilter(request, response);
}

Martin--
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




Date: Thu, 24 Mar 2011 01:02:43 +0200
Subject: Re: Cache-Control headers
From: steliyanpgeorgiev_at_gmail.com
To: derek_at_itracmedia.com; users_at_glassfish.java.net

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