I'm looking for input on the best way to handle MIME types in Tomcat.
ServletContext.getMimeType(String fileName) returns a MIME type based on the server (or web apps) web.xml MIME type mapping configuration. This is case sensitive, thus using the default web.xml file that comes with Tomcat 5.5getMimeType() returns null for a file ending in '.JPG' vs. 'image/jpeg' for a file ending in '.jpg'. This reliance on trusting file extension for MIME type vs. say the magic number seems problematic to me. At the very least why not use the magic number on systems that support it and then fall back to the mapping in the web.xml? Additionally, I have code which converts file extensions to lower case before sending them to getMimeType to work around adding upper and mixed case mappings in a web.xml file. Is there a better way to do this? TIA -NW