Reputation: 519
I'm using OmniFace 2.7 with Primefaces 6.0. I set with CacheControlFilter an expire time of 365d for all image types (*.jpg
| *.jpeg
| *.png
| *.gif
| *.ico
).
This browser caching settings seem not to apply to CSS background images that get an URL like:
.../playground/javax.faces.resource/images/smiley.jpg.xhtml
Same apply to the combined resource files (CSS and JS) that have an URL like:
.../javax.faces.resource/LONG-HASH.js.jsf?ln=omnifaces.combined&v=1544138175000
Any hints to solve this issue would be very helpful. Thanks
Upvotes: 0
Views: 163
Reputation: 1109262
The answer is in the showcase and documentation of CacheControlFilter
.
Important notice: this filter automatically skips JSF resources, such as the ones served by
<h:outputScript>
,<h:outputStylesheet>
,@ResourceDependency
, etc. Their cache-related headers are namely already controlled by theResourceHandler
implementation. In Mojarra and MyFaces, the default expiration time is 1 week (604800000 milliseconds), which can be configured by aweb.xml
context parameter with the following name and a value in milliseconds, e.g.3628800000
for 6 weeks:
- Mojarra:
com.sun.faces.defaultResourceMaxAge
- MyFaces:
org.apache.myfaces.RESOURCE_MAX_TIME_EXPIRES
It would not make sense to control their cache-related headers with this filter as they would be overridden anyway.
I don't have much to add on this.
Upvotes: 1