The valid characters are defined in RFC 7230 and RFC 3986

异常信息:

 信息: Error parsing HTTP request header
 Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986
    at org.apache.coyote.http11.InternalAprInputBuffer.parseRequestLine(InternalAprInputBuffer.java:235)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1028)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2549)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2538)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:748)

tomcat新版本不允许URL里带有中文,需要先进行编码,再请求,请求过程中tomcat会进行解码。

请求信息里面的中文乱码

tomcat解码默认为 ISO8859-1格式,会出现乱码,需要修改配置文件conf/server.xml


修改为 UTF-8


也可以单个处理

param = new String (param.getBytes("iso8859-1"),"UTF-8")

你可能感兴趣的:(The valid characters are defined in RFC 7230 and RFC 3986)