tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: specifying the content-type
Date Tue, 07 Jun 2011 19:29:52 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bernd,

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 http://de.selfhtml.org/html/kopfdaten/meta.htm#zeichenkodierung
(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
you.

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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3ufDAACgkQ9CaO5/Lv0PDsHwCgoMbKhbz20nCj8t8WTY1ZoP+O
AuIAn0Qx5Kse+nHp0jqv8rVJcCkdkdPE
=27hs
-----END PGP SIGNATURE-----

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


Mime
View raw message