How to set default mime-tipe for any file extension in Tomcat 6? -


Wax-type tomcat con / web Specified in the XML file it looks like this:

  & lt; Mime-maping & gt; & Lt; Expansion & gt; Txt & lt; / Extension & gt; & Lt; Mime-type & gt; Text / plain & lt; / Mime-type & gt; & Lt; / Mime-mapping & gt;  

First I try the following:

  & lt; Mime-maping & gt; & Lt; Expansion & gt; * & Lt; / Extension & gt; & Lt; Mime-type & gt; Application / octet stream & lt; / Mime-type & gt; & Lt; / Mime-mapping & gt;  

But how does it specify the default mime-type for any file extension that does not help me?

There is no way you have to explicitly set them yourself servlet filter is a suitable place for this is.

  Public Zero doFilter (ServletResponse response, FilterChain series) throws ServletException, IOException {response.setContentType ("application / octet-stream"); Chain.doFilter (request, response); }  

But I do a lot more questions about the need for business for this. This is only harmful to SEO and to the customer. If your only purpose is to pop the conversation as an save , then you should say so. It's a better solution to get the wrong MIME type firmly.


Comments