response.setContentType()总是修剪“;”之间的空格字符集&QUOT ;? [英] response.setContentType() always trim the space between "; charset"?

查看:124
本文介绍了response.setContentType()总是修剪“;”之间的空格字符集&QUOT ;?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Tomcat 6.0.20,HttpServlet

I'm using Tomcat 6.0.20, HttpServlet

我的servlet代码如下: -

my servlet code are as followings :-

response.setContentType("application/xml; charset=utf-8");

但每次我都会得到以下内容类型:

but each time i will got the content type as :

application/xml;charset=utf-8

没有;之间的空格。

我可以知道如何绕过正在修剪的空间吗?

May i know how to bypass the space being trimmed?

有没有这样做(例如:修改servet-api.jar)?

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

推荐答案

可能会发生在Tomcat中,在Tomcat前面的反向代理中,在代理,防火墙或客户端堆栈中的某个位置。这可能是不可能阻止这样做的。

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.

但这应该不重要。 HTTP标准说分号后面有可选的空格。 无论空间是否存在,您的客户端代码都应该正常工作

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.

这篇关于response.setContentType()总是修剪“;”之间的空格字符集&QUOT ;?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆