开发者

response.setContentType() always trim the space between "; charset"?

开发者 https://www.devze.com 2023-01-10 23:03 出处:网络
I\'m using Tomcat 6.0.20, HttpServlet my servlet code are as followings :- response.setContentType(\"ap开发者_运维百科plication/xml; charset=utf-8\");

I'm using Tomcat 6.0.20, HttpServlet

my servlet code are as followings :-

response.setContentType("ap开发者_运维百科plication/xml; charset=utf-8");

but each time i will got the content type as :

application/xml;charset=utf-8

which is without the space between " ; ".

May i know how to bypass the space being trimmed?

Is there anyway to do so (eg : modify the servet-api.jar)?


It could be happening in Tomcat, in a reverse proxy in front of Tomcat, in a proxy, a firewall or somewhere in the client-side stack. It is probably impossible to stop whatever is doing this.

But it should not matter. The HTTP standard says that there is optional whitespace after the semicolon. Your client-side code should work whether the space is present or not.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号