I want to implement cache busting via string query with the file version, but I also want to use @ResourceDependency. So this is what I have:
@ResourceDependency(name = "scrypt.js?v=version", library = "mylib", target = "head")
I know mojarra had trouble with string queries before for the <f:outputScript>
, but this has been fixed (stackoverflow question). But apparently they never really supported string queries for the annotation.
The problem is in ResourceDependencyHandler#createComponentResource
. It calls ResourceHandler#getRendererTypeForResourceName
that returns null
if the name
provided has a string query attached to it. This actually goes back all the way to ServletContext#getMimeType
. That is the guy who can't realize the mime type is application/javascript
when there is a query string attached to the file name.
Does anybody knows a workaround for this? I'm currently working with Mojarra 2.2.8.
Thank you.
The fully qualified names of the classes I mentioned:
com.sun.faces.application.annotation.ResourceDependencyHandler
javax.faces.application.ResourceHandler