-
Available since OmniFaces 3.9
Automatically adds version parameter with query string name
v
to all resource URLs so that the browser cache will be busted whenever the version parameter changes.
NOTE: if resource URL already has v
query string parameter, or when it is URL-rewritten to not include "/jakarta.faces.resource"
path anymore, then these will be ignored.
Installation
To get it to run, this handler needs be registered as follows in faces-config.xml
:
<application>
<resource-handler>org.omnifaces.resourcehandler.VersionedResourceHandler</resource-handler>
</application>
And the version parameter needs to be configured as follows in web.xml
:
<context-param>
<param-name>org.omnifaces.VERSIONED_RESOURCE_HANDLER_VERSION</param-name>
<!-- Version parameter value could be any hardcoded string here, or any object property from managed bean -->
<param-value>#{environmentInfo.version}</param-value>
</context-param>
Documentation & Sources