I ran into an issue serving the proper mime type for a cache manifest from grails today, adding a ‘manifest’ key to grails.mime.types failed to register for some reason (if you know why, do tell!). Running on a server this can be addressed by setting the mime type directly in tomcat, but i needed to test locally using the built in Tomcat server. Hopefully this inability to serve a manifest mime type will be addressed soon, but in the meantime the workaround was to make the manifest a generated gsp and add the content-type declaration directly to the manifest:
<%@ page contentType="text/cache-manifest" %>CACHE MANIFEST
# rev 0
file.html
It’s important to keep CACHE MANIFEST on the same line as the contentType property – manifests are discarded if they don’t start from the first character with that declaration.
One last thing – this works better cross browser (where some browsers dont respect a manifest not ending in .manifest) by setting grails.mime.file.extensions to false, which will allow your mapping to be directly to cache.manifest, returning the rendered gsp.
Awesome this helped greatly! The grails.mime.types setting didn’t work for me either >.<
I actually figured out a way to do this without having to set grails.mime.file.extensions to false
If you add the following:
manifest
text/cache-manifest
To the
src/war/web.xml
Hmmm formatting stripped out my tag characters… trying again:
One more time with feeling!
Thanks for the tip! Really annoying how Grails just ignores that mime-type setting..