ITeye博客

tomcat的URIEncoding的作用(转)

iblike · 2011-08-16 09:49 · tomcat · 编程语言 · Markdown

tomcat5中,为了保证get数据采用UTF8编码,在server.xml中进行了如下设置:

<Connector port="8080" maxThreads="150" minSpareThreads="25"
maxSpareThreads="75" enableLookups="false" redirectPort="8443"
acceptCount="100" debug="99" connectionTimeout="20000"
disableUploadTimeout="true" URIEncoding="UTF-8"/>

这里指定了get时候的数据编码。但是,当使用IIS作为webserver转发servlet/jsp请求给Tomcat时候,这个设置却失效了。其实 原因很简单:IIS是通过AJP协议,把请求转发到Tomcat监听的8009端口上的,所以这里针对8080的设置自然就无效了。正确的方法是进行下面 的设置:

<Connector port="8009" enableLookups="false" redirectPort="8443"
debug="0" protocol="AJP/1.3" URIEncoding="UTF-8"/>

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。