You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Eisenträger, Tobias <To...@arag.de> on 2009/12/11 12:57:42 UTC

Caching from static content

Hello List,

 

Is there a parameter where one can enable the caching for static content, for example images, css and external javascript?

 

It looks like Trinidad or myfaces is adding this to the header:

 

Pragma: No-cache

Cache-Control: no-cache

Expires: Thu, 01 Jan 1970 01:00:00 CET

Etag:  W/"377-1245852154000"

 

So I wrote a filter, and I added max-age and such to the javax.servlet.ServletResponse, so now I have:

Server Apache-Coyote/1.1

Pragma No-cache

Cache-Control no-cache, max-age=86400, pre-check=86400, post-check=86400

Expires Thu, 01 Jan 1970 01:00:00 CET, Sat, 12 Dec 2009 12:52:54 GMT

Last-Modified Fri, 11 Dec 2009 11:52:54 GMT

Etag W/"377-1245852154000"

Date Fri, 11 Dec 2009 11:52:54 GMT

 

So how do I get the old headers removed, or which part of the framework is creating them?

 

Thanks!

 

 

Mit freundlichen Grüßen 

 

Tobias Eisenträger

 


Re: AW: Caching from static content

Posted by "Mike Quentel (4DM)" <mq...@4dm-inc.com>.
Hi Tobias,

Many thanks for providing this information!  

Even when a solution to a posted problem has more to do with an external system (such as a servlet container) than with MyFaces itself, I very much appreciate anyone who shares these tips. 

Cheers, 

Mike Quentel
Senior Geospatial Software Developer
4DM Inc.
671 Danforth Avenue Suite 305
Toronto, Ontario
M4J 1L3
Ph/Fax 416 - 410-7569
www.4dm-inc.com
Providing solutions through mapping technology....

-----Original Message-----
From: Eisenträger, Tobias <To...@arag.de>
Date: Fri, 11 Dec 2009 15:38:22 
To: MyFaces Discussion<us...@myfaces.apache.org>
Subject: AW: Caching from static content

It was not trinidad or myfaces, it was tomcat adding the no-cache because i was using it in a secure context. I added the following parameters in the context.xml:

<Valve className="org.jaaslounge.sso.tomcat.spnego.SpnegoValve"
                        domainController="hhhhhh.de.nnnn.xxxx"
                        domainName="nnn.nnn.de"
                        disableProxyCaching="false" />

The default of disableProxyCaching = true, the problem is just that the IE does not use this header setting right :o)

Also see:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html
https://issues.apache.org/bugzilla/show_bug.cgi?id=28750
https://issues.apache.org/bugzilla/show_bug.cgi?id=27122


Mit freundlichen Grüßen 

 

Tobias Eisenträger


> -----Ursprüngliche Nachricht-----
> Von: Eisenträger, Tobias [mailto:Tobias.Eisentraeger@arag.de]
> Gesendet: Freitag, 11. Dezember 2009 12:58
> An: MyFaces Discussion
> Betreff: Caching from static content
> 
> Hello List,
> 
> 
> 
> Is there a parameter where one can enable the caching for static content,
> for example images, css and external javascript?
> 
> 
> 
> It looks like Trinidad or myfaces is adding this to the header:
> 
> 
> 
> Pragma: No-cache
> 
> Cache-Control: no-cache
> 
> Expires: Thu, 01 Jan 1970 01:00:00 CET
> 
> Etag:  W/"377-1245852154000"
> 
> 
> 
> So I wrote a filter, and I added max-age and such to the
> javax.servlet.ServletResponse, so now I have:
> 
> Server Apache-Coyote/1.1
> 
> Pragma No-cache
> 
> Cache-Control no-cache, max-age=86400, pre-check=86400, post-check=86400
> 
> Expires Thu, 01 Jan 1970 01:00:00 CET, Sat, 12 Dec 2009 12:52:54 GMT
> 
> Last-Modified Fri, 11 Dec 2009 11:52:54 GMT
> 
> Etag W/"377-1245852154000"
> 
> Date Fri, 11 Dec 2009 11:52:54 GMT
> 
> 
> 
> So how do I get the old headers removed, or which part of the framework is
> creating them?
> 
> 
> 
> Thanks!
> 
> 
> 
> 
> 
> Mit freundlichen Grüßen
> 
> 
> 
> Tobias Eisenträger
> 
> 


AW: Caching from static content

Posted by Eisenträger, Tobias <To...@arag.de>.
It was not trinidad or myfaces, it was tomcat adding the no-cache because i was using it in a secure context. I added the following parameters in the context.xml:

<Valve className="org.jaaslounge.sso.tomcat.spnego.SpnegoValve"
                        domainController="hhhhhh.de.nnnn.xxxx"
                        domainName="nnn.nnn.de"
                        disableProxyCaching="false" />

The default of disableProxyCaching = true, the problem is just that the IE does not use this header setting right :o)

Also see:
http://www.mail-archive.com/tomcat-user@jakarta.apache.org/msg151294.html
https://issues.apache.org/bugzilla/show_bug.cgi?id=28750
https://issues.apache.org/bugzilla/show_bug.cgi?id=27122


Mit freundlichen Grüßen 

 

Tobias Eisenträger


> -----Ursprüngliche Nachricht-----
> Von: Eisenträger, Tobias [mailto:Tobias.Eisentraeger@arag.de]
> Gesendet: Freitag, 11. Dezember 2009 12:58
> An: MyFaces Discussion
> Betreff: Caching from static content
> 
> Hello List,
> 
> 
> 
> Is there a parameter where one can enable the caching for static content,
> for example images, css and external javascript?
> 
> 
> 
> It looks like Trinidad or myfaces is adding this to the header:
> 
> 
> 
> Pragma: No-cache
> 
> Cache-Control: no-cache
> 
> Expires: Thu, 01 Jan 1970 01:00:00 CET
> 
> Etag:  W/"377-1245852154000"
> 
> 
> 
> So I wrote a filter, and I added max-age and such to the
> javax.servlet.ServletResponse, so now I have:
> 
> Server Apache-Coyote/1.1
> 
> Pragma No-cache
> 
> Cache-Control no-cache, max-age=86400, pre-check=86400, post-check=86400
> 
> Expires Thu, 01 Jan 1970 01:00:00 CET, Sat, 12 Dec 2009 12:52:54 GMT
> 
> Last-Modified Fri, 11 Dec 2009 11:52:54 GMT
> 
> Etag W/"377-1245852154000"
> 
> Date Fri, 11 Dec 2009 11:52:54 GMT
> 
> 
> 
> So how do I get the old headers removed, or which part of the framework is
> creating them?
> 
> 
> 
> Thanks!
> 
> 
> 
> 
> 
> Mit freundlichen Grüßen
> 
> 
> 
> Tobias Eisenträger
> 
>