-
1. How to enable caching javascript and css files of Richfaces
nbelaevski May 8, 2011 4:40 PM (in response to pechnik)Hi Bronislav,
What RichFaces version do you use? Are you using HTTP or HTTPS?
-
2. How to enable caching javascript and css files of Richfaces
pechnik May 10, 2011 11:05 AM (in response to nbelaevski)I am using Richfaces 4 with HTTP and Glassfish 3.0
-
3. Re: How to enable caching javascript and css files of Richfaces
jgoodfellow Oct 13, 2011 2:44 PM (in response to pechnik)Hello Bronislav,
To change the client-side caching for the dynamic stylesheets in Richfaces use the org.richfaces.resourceDefaultTTL context parameter (set to # of seconds). The static stylesheet and javascript files are served by your JSF2 container. In your case it's Glassfish. In my case it's MyFaces. ( I use the org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES context parameter ). You should be careful about giving too long of a caching period as Richfaces does not version their static javascript files (like richfaces.js). This means when you upgrade richfaces and changes to those files have occurred, they may not get propagated when you need them to. The way I've solved this problem is to customize the behavior of the HtmlScriptRenderer and HtmlStylesheetRenderer to pass a version parameter in the script url's. Example: instead of http://ABC/javax.faces.resource/richfaces.js.faces, the url is http://ABC/javax.faces.resource/richfaces.js.faces?rfv=4.1.0.20110910-M2.