[Miles' Blog]

Welcome 2 My Planet

Available categories: [/] [working on downwap.] [trouble shooting] [working on Yup Mailman]

TOMCAT 5: 关于Connector的URIEncoding属性|About "URIEncoding" attribute in the "Connector" tag. [Permalink]

Tue Apr 19 14:09:48 CST 2005
Category [development. ~]

tomcat5中,因为众所周知的原因,为了保证get/post数据都采用相同的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"/>
虽然是小问题,却花了我几个小时才想到。 /images/emoticons/plain.gif

Posted by: miles
Comments [0] |

?
四月 2024
Sun? Mon? Tue? Wed? Thu? Fri? Sat?
 123456
78910111213
14151617181920
21222324252627
282930    
       
<  Mar???Today??? May  >
<< <   1   > >>

Available categories: [/] [working on downwap.] [trouble shooting] [working on Yup Mailman]

Powered By blojsom?? RSS Feed? RSS2 Feed? RDF Feed

html hits:?51281