"application/vnd.wap.mms-message". But I will recheck my code if I am
"application/vnd.wap.mms-message". If it does not work, I will wrap the
response as you suggested. Thanks for your response and suggestions.
Post by Jilles van GurpPost by Alpay OzturkHi,
I am using Tomcat 4.1.29 in a production environment and I want tomcat
not to add default charset in Content-Type response header.
Is it possible?
Thanks in advance.
Alpay
---------------------------------------------------------------------
No, it's not possible for text/* types. Tomcat will set a default
charset if you don't set it yourself. For jsps you can change the
default encoding by overriding it in your web.xml (see conf/web.xml for
the defaults).
BTW I suspect you might be wanting this because you are trying to set
the content type twice: first to text/html (tomcat will set a charset
automatically because the servlet spec says text/html should be
accompanied by a charset) and then to application/pdf (you end up with
content-type: application-pdf; charset=utf-8). We ran into this issue
before: you can't get rid of the charset once it is set and you need to
set a content-type before you start streaming content.
The only thing you might be able to do is to filter the http header with
apache or something. Trying to correct this from a servlet filter is
tricky because the headers are streamed to the client before the
content. The only way to work around this is to wrap the response and
buffer the output, set the header in the real response and the stream
the buffered content (tomcat will still set a default charset if the
type is text/*).
The best solution is to simply accept that the charset needs to be set
correctly for text/* and to do that yourself.
Jilles
---------------------------------------------------------------------