Dave Pawson wrote:
Hi Rob
2009/2/5 Robert Koberg <r...@koberg.com>:
On Feb 5, 2009, at 1:28 PM, Caldarale, Charles R wrote:
From: Dave Pawson [mailto:dave.paw...@gmail.com]
Subject: TC6 ${CATALINA_HOME}/conf/web.xml Is this the place
to constrain the mime type?
Just to clear up your question above : no.
In many more words :
Part 1:
the file ${CATALINA_HOME}/conf/web.xml is the "default", tomcat-wide
web.xml. It plays the same role as each webapp's web.xml that resides
in the WEB-INF/web.xml of each webapp. But each of these applies only
to its particular webapp, while the general webapp first named applies
to all webapps, by default.
Part 2:
In each webapp, there is a "default servlet" provided by Tomcat, whose
role is to handle each request that was directed to this webapp, but for
which no specific "url-mapping" could be found in that webapp's web.xml.
That default servlet handles, for instance, requests for static content,
like "/mywebapp/my_dog.jpg".
Part 3 :
When this servlet returns some static content, and since it is after all
part of a specific webapp, it looks first in it's own webapp's web.xml
for paramaters applicable to him. But since it probably doesn't find
any, it defaults to the parameters of the default tomcat-wide web.xml,
which is... ${CATALINA_HOME}/conf/web.xml.
Part 4 :
By some incredible clever setup, that default web.xml happens to contain
a table of Mime mappings, telling the default servlet that if what it
has to return this time is some file ending in ".jpg", it should include
a HTTP header "Content-type: image/jpeg" (so that the browser would
know how to handle this correctly). Or if the file ends in ".xls", it
should return a header "Content-type: application/vnd.ms-excel" (or
something like that).(*)
So, in other words, if you change something in these Mime mappings,
chances are that your Tomcat is going to start returning images while
telling the browser they are Word documents, and things like that which
make for an entertaining display in the web browser.
Which is probably not what you want.
(Proudly, based on recent teaching by Chuck. Have I got it right, Chuck ?)
(*) Of course if the browser is IE, it doesn't matter anyway, because IE
will not believe what the server tells it and do its own thing.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org