Spring3 @ResponseBody注解引起头部Accept-Charset过大 zj_oschina
默认情况下StringHttpMessageConverter.writeInternal()会将所有可用字符集回写到response响应头中中,从而导致整个response的头部变大,实测占了大概2K的空间,在高并发的情况下,会造成网络拥塞
解决方法:在spring-mvc配置文件中,加下以下配置,关闭默认的writeAcceptCharset
<mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <!-- 将StringHttpMessageConverter的默认编码设为UTF-8 --> <bean class="org.springframework.http.converter.StringHttpMessageConverter"> <constructor-arg value="UTF-8" /> <property name="writeAcceptCharset" value="false"/> </bean> </mvc:message-converters> </mvc:annotation-driven>