When you have multiple resources (js, css, images) it's a great performance boost to set the caching policy in production environment, so that the browser won't ask each time if new version of resource is available.
The issue is, when you update the application, the browser still uses (for some time) the old resources. While with css and images it's an inconvinience, when it's JavaScript, the application will mostly not function.
The solution is well known. Either rename the resources (not practical) or apppend version param to request (such as &ver=XYZ
).
My question is, how to do the second in JSF 2? So, do not change library name or create new folder for new version in resources. I want to have the request parameter appended to request, preserving resource path.
How to append such param to resources included via h:outputScript
and h:outputStylesheet
tags in xhtml, and via @ResourceDependency
annotation in custom components?
At best, if it could be specified globally in application, and affecting all generated resource links.