报错:
java.lang.IllegalArgumentException:
Invalid character found in the request target.
The valid characters are defined in RFC 7230 and RFC 3986
原因:
当在浏览器中访问时 URL中带有特殊字符,如花括号冒号时,就会出现这个错误。
如:http://localhost:8080/index.do?{name:lll}
解决:
1、去除URL中的特殊字符;
2、特殊字符是出现在后面跟的参数中,对参数进行 URL 编码,可以使用 JavaScript 中的 encodeURIComponent() 函数。
3、使用 Post 方法提交数据
4、换低版本的Tomcat来规避。
5、在 conf/catalina.properties 中最后添加一行,之后重启服务器
org.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true