The valid characters are defined in RFC 7230and RFC 3986

高版本tomcat出现如下错误信息:
java.lang.IllegalArgumentException: Invalid character found inthe request target. The valid characters are defined in RFC 7230and RFC 3986
atorg.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.
atorg.apache.coyote.http11.Http11Processor.service(Http11Processor.
atorg.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.
atorg.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.
atorg.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.
atorg.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.
at java.util.concurrent.ThreadPoolExecutor.runWorker(UnknownSource)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(UnknownSource)
atorg.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.
at

我这里是一个以http方式访问图片的功能,因为参数中的路径有转义字符,所以报错。可能是高版本的tomcat对请求路径url要求更为严格的问题。之前用低版本的tomcat是可以的。

解决办法:将带有转义字符的参数进行url编码即可。

你可能感兴趣的:(tomcat)