[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]tomcat的server.xml中,URIEncoding和useBodyEncodingForURI的区别

上一篇:[备忘]Ajax无法捕捉服务端的302跳转~~
下一篇:[备忘]javascript的this真让人头疼~

添加日期:2014/6/20 15:09:48 快速返回   返回列表 阅读4547次
apache tomcat官方网站对这两个参数的解释:
 
URIEncoding
This specifies the character encoding used to decode the URI bytes, after %xx decoding the URL. If not specified, ISO-8859-1 will be used.

大概意思就是按什么编码解析%xx的部分。
-------------------------------------------
useBodyEncodingForURI
This specifies if the encoding specified in contentType should be used for URI query parameters, instead of using the URIEncoding. This setting is present for compatibility with Tomcat 4.1.x, where the encoding specified in the contentType, or explicitly set using Request.setCharacterEncoding method was also used for the parameters from the URL. The default value is  false .

如果http请求中,在contentType中指定了编码方式,那么将采用contentType的编码方式去解码url之后的查询参数,将忽略URIEncoding的配置.
而且这个是为了兼容4.1版本,很明显,不该使用这个。
-------------------------------------------
所以,应该使用URIEncoding="utf-8"这样来设置URL解码方式。

换句话说,URIEncoding只影响get方式的url的解码,不影响post的解码喽。
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved