I am trying out the UnmappedResourceHandler in OmniFaces, originally I had all my resources under a directory structure like:
WebContent
|-- resources
| `-- default
| `-- 1_0
| |-- css
| | `-- style.css
| |-- img
| | `-- logo.png
| `-- js
| `-- script.js
The UnmappedResourceHandler doesn't work with the versioning, instead this works:
WebContent
|-- resources
| `-- default
| |-- css
| | `-- style.css
| |-- img
| | `-- logo.png
| `-- js
| `-- script.js
I haven't read anywhere that it doesn't work so I am wondering am I missing something?
thanks,
It's mentioned in the javadoc and showcase.
The technical limitation is that it's otherwise not possible to relatively reference resources from inside the CSS file. When using libraries, the path
/defaultwould be moved to query parameter?ln=defaultand then the CSS file would be looking for relative image references in the wrong relative folder/resources/cssinstead of/resources/default/css.You've 2 options:
Manually append the version to the query string.
You could even write another custom resource handler for that.
Use the file name based versioning.
It's only uglier.
Regardless, feel free to just remove the
/defaultfolder in the end.