tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: specifying the content-type
Date Tue, 07 Jun 2011 19:29:52 GMT
Hash: SHA1


On 6/7/2011 2:23 PM, Lentes, Bernd wrote:
> Christopher Schultz wrote:
>> How did you do it? If you use <META HTTP-EQUIV="Content-Type"
>> CONTENT="text/html" />, it should override any Content-Type
>> sent in the HTTP response headers
> Yes, we used this. But
(unfortunally only in german) says
> "Im Konfliktfall, also wenn der Webserver im HTTP-Header eine hiervon abweichende Angabe
sendet, wird ├╝blicherweise die Angabe des HTTP-Headers verwendet.", which means that, if
you have the META in the HTML-file and also the content-type in the HTTP-Header, mostly the
HTTP-Header "wins".

You're right. I had it wrong: the HTTP header overrides the content of
the document.

>>> Our developers try now to use the
>>> response.setContentType("text/html"); method to configure the
>>> content-type in the HTTP-Header.
>> This is the proper way to do things. Using <META> does not hurt.
>> So... did it work?
> Using the META didn't work, the other way they'll try in the next days. I will inform

If you want to be lazy with your code, you could use a Filter to set the
Content-Type of all responses to text/html before the servlet gets a
chance to set anything. If the servlet overrides it, everything is okay.
If not, the Content-Type remains set to text/html.

It's basically the same as using DefaultType in httpd but would require
you to do more work. :(

- -chris
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message