在使用下载文件的工具类DownLoadUtils时,会遇到报错
NFO 20044 — [nio-8080-exec-6] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
主要原因是server.xml文件里没有配置Tomcat的header缓冲区大小,默认缓存区无法满足时报错,只需要在 Tomcat中的server.xml中增加maxHttpHeaderSize字段即可: 还需要设置URIEncoding=“UTF-8”
就可以下载东西的时候显示中文的文件名了
<Connector port="7070" executor="tomcatThreadPool" protocol="HTTP/1.1"
connectionTimeout="20000"
maxHttpHeaderSize="8999"
URIEncoding="UTF-8"