Hi, There are two main contraptions in Tomcat that do (badly ...) extension to mime type mapping: the shared web.xml and some hardcoded stuff in startup.Tomcat.
While we should obviously have support for user configured mime types in web.xml, as it's the spec, there should be a possibility to use Files.probeContentType as the fallback when a mime type isn't found (and maybe also have an option to disable it ? - although I don't quite see why it would bother anyone). After looking at its implementation, it looks into all mime type locations we might want (the OS, a mime.types file, etc). The only problem is that it uses a Path (that would be an issue since it's super tied to a real filesystem), but thankfully it mostly uses toSting and thus can be worked around using a new fake Path implementation. The code calling Files.probeContentType could be inserted here in DefaultServlet: // Find content type. String contentType = resource.getMimeType(); if (contentType == null) { contentType = getServletContext().getMimeType(resource.getName()); ---> resource.setMimeType(contentType); } And then all the badly maintained content from web.xml and the Tomcat class can be deleted. Comments ? Rémy