How can I set the mime-type dynamically through serveletContext object? (there is a setAttribute… can I use that and if so what would the attribute name be?
Basically, I want to override the mime-type that is specified in the web.xml either at servlet initialization time (via the Init method), or some other way in a programmatic manner as oppose to changing the web.xml entry statically.
My case scenario is as follows: By default web.xml file has the following mime-type for .log extensions:
<mime-mapping>
<extension>log</extension>
<mime-type>**text/plain**</mime-type>
</mime-mapping>
I want to change that to:
<mime-mapping>
<extension>oqcrlog</extension>
<mime-type>**application/octet-stream**</mime-type>
</mime-mapping>
How can I change this mime-type association in my web app under tomcat in a programmatic manner?
Thank you
Not possible, even if using Servlet 3.0 (tomcat 7).
But as mime-types are predefined you would normally just add that one there manually.