tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: TC6 ${CATALINA_HOME}/conf/web.xml Is this the place to constrain the mime type?
Date Fri, 06 Feb 2009 17:15:05 GMT
Dave Pawson wrote:
> Thanks Andre. That paints a good picture!
> 
> Only generality I'd like to add. The "general purpose" of my-app web.xml and
> 'all apps' web.xml. Is it TC 'configuration' (Chaz isn't going to like
> that, but I
> do like an overview, even if it's only 80%). I'm saying config, since
> it provides
> response mime types, params etc.
> 
> 2009/2/5 André Warnier <aw@ice-sa.com>:
> 
>> 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).(*)
> 
> Question: Using your analogy of 'my-app' web.xml being used first, then
> falling back on 'all-apps' web.xml, can I add 'specials' in the list of mime
> type? I'm thinking of application/atom+xml
> 

Looking at a comment in the main conf/web.xml :
  <!-- When serving static resources, Tomcat will automatically generate 
    -->
   <!-- a "Content-Type" header based on the resource's filename 
extension,  -->
   <!-- based on these mappings.  Additional mappings can be added here 
(to  -->
   <!-- apply to all web applications), or in your own application's 
web.xml -->
   <!-- deployment descriptor. 
      -->

So I guess yes, they are cumulated, if that is your question.

> 
> 
> 
>> 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.
> 
> I'm looking at a mc - mc service, so I'm not expecting browsers.
> 
Well, in your logfiles then probably.
XML parsers might also be rather partial to input files with the wrong type.

> 
>> 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.
> 
> <grin/> If the browser is IE I'll .... No I won't.
> 
> 
> Thanks Andre.
> Nice and clear.
> (Note the comment about Chaz in the background :-) "Close enough"!
> 
> 
Yeah.  But coming from Chuck, I think that's praise enough.
I'm all thrilled that he didn't find anything in it that was contrary to 
the Servlet Specification, paragraph x.y.
Or else he was distracted.



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message