访问

http://127.0.0.1:8080/api?method=taxiong.goods.list&params={"page":1,"pageSize":10}

出现了如下错误

2018-08-09 21:39:28.915  INFO 6750 --- [nio-8080-exec-1] o.apache.coyote.http11.Http11Processor   : 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.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:479) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.32.jar:8.5.32]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800) [tomcat-embed-core-8.5.32.jar:8.5.32]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471) [tomcat-embed-core-8.5.32.jar:8.5.32]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.32.jar:8.5.32]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_111]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_111]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.32.jar:8.5.32]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]

网上找了下,大概是这样解释的:

这个问题是由于Tomcat的新版本中增加了一个新特性,就是严格按照 RFC 3986规范进行访问解析,而 RFC 3986规范定义了Url中只允许包含英文字母(a-zA-Z)、数字(0-9)、-_.~4个特殊字符以及所有保留字符(RFC3986中指定了以下字符为保留字符:! * ’ ( ) ; : @ & = + $ , / ? # [ ])。

解决方案:

  ① 可以客户端请求时URL encode处理特殊字段

  ② 改用 post 请求 『由于我这是一个新服务在开发中,所以选用了这种方案』

  ③ 改 Tomcat 配置文件

    http://tomcat.apache.org/tomcat-8.0-doc/config/systemprops.html#Other

    官方描述如下

tomcat.util.http.parser.HttpParser. requestTargetAllow
This system property is deprecated. Use the relaxedPathChars and relaxedQueryChars attributes of the Connector instead. These attributes permit a wider range of characters to be configured as valid. A string comprised of characters the server should allow even when they are not encoded. These characters would normally result in a 400 status. The acceptable characters for this property are: |, { , and } WARNING: Use of this option may expose the server to CVE-2016-6816. If not specified, the default value of null will be used.

SpringBoot2.0 url中出现特殊符号「带括号{}'"等等」时会抛出400错误的更多相关文章

  1. url中的特殊符号含义

    1. # 10年9月,twitter改版.一个显著变化,就是URL加入了"#!"符号.比如,改版前的用户主页网址为http://twitter.com/username改版后,就变 ...

  2. 你知道url中的特殊符号含义么

    1.# #代表网页中的一个位置.其右面的字符,就是该位置的标识符.比如,http://www.example.com/index.html#print就代表网页index.html的print位置.浏 ...

  3. URL中一些特殊符号的替代符

    下表中列出了一些URL特殊符号及编码 十六进制值 1.+ URL 中+号表示空格 %2B 2.空格 URL中的空格可以用+号或者编码 %20 3./ 分隔目录和子目录 %2F 4.? 分隔实际的 UR ...

  4. 从0开始学习 GitHub 系列之「03.Git 速成」

    前面的 GitHub 系列文章介绍过,GitHub 是基于 Git 的,所以也就意味着 Git 是基础,如果你不会 Git ,那么接下来你完全继续不下去,所以今天的教程就来说说 Git ,当然关于 G ...

  5. 从0开始学习 GitHub 系列之「02.加入 GitHub」

    转载地址: http://blog.csdn.net/googdev/article/details/52787586 看完昨天的文章「从0开始学习 GitHub 系列之「初识 GitHub」」估计不 ...

  6. 在Springboot2.0项目中使用Druid配置多数据源

    在Springboot出现之前配置数据源以及相关的事物,缓存等内容一直是个繁琐的工作,但是Springboot出现后这些基本都可以靠默认配置搞定,就变得很轻松了.这就是现在推崇模板>配置的原因, ...

  7. 将SSM架构中原来关于springSecurity3.x版本的写法配迁移到SpringBoot2.0框架中出现的问题解决记

    迁移过程中关于这个安全框架的问题很麻烦,springBoot自带的stater中的版本是5.0,原来系统有通过实现"org.springframework.security.authenti ...

  8. SpringBoot2.0 项目中使用事务

    参考博客: SpringBoot开启事务常见坑点 另外注意手动回滚事务需要 (1)在业务层方法上添加注解 @Transactional (2)在需要回滚的地方添加代码: TransactionAspe ...

  9. IntellJ IDEA2017 springboot2.0.2中读取配置

    IDEA 路径 src\main\resources\application.properties 配置文件名称为 application.properties 默认的位置在classpath根目录下 ...

随机推荐

  1. P1131 [ZJOI2007]时态同步(树形dp)

    P1131 [ZJOI2007]时态同步 设$f[i]$为与$i$与最远的点的距离 在dfs时每次更新的时候顺便统计一下长度,不同的话就改成最长的那条并更新答案 #include<iostrea ...

  2. Django:提交表单时遇到403错误:CSRF verification failed

    Django:提交表单时遇到403错误:CSRF verification failed 问题: 提交表单时遇到403错误:CSRF verification failed 解决方案: 在表单界面ht ...

  3. SqlServer2012数据导入

    1.选择数据库,右击[任务]-->[导入数据]: 2.选择对应的数据源,和数据文件,下一步: 3.填写服务器地址,和数据库的登录信息,选择数据库名称: 4.复制一个或多个表或试图的数据: 5.将 ...

  4. linux history记录格式修改

    #保存一万条命令记录 sed -i 's/^HISTSIZE=1000/HISTSIZE=10000/g' /etc/profile #在/etc/profile的文件尾部添加如下行数配置信息 ### ...

  5. Cooperation.GTST团队第三周项目总结

    项目进展 这周我们仍然在学习使用博客园的相关接口,页面的一个基本模块已经搭建出来了,但是页面整体效果还没有完全做出来.另外,我们在使用其他的APP时留意到许多APP都使用上拉加载和下拉刷新的效果,所以 ...

  6. vim 录制宏,自动循环执行组合操作

    前言 在 vim 中录制宏的意思就是把一段操作录制下来,然后可以重复执行.打个比方,我有一个文本,一共 50000 行,我要在每一行后面加一个英文句号.这个操作如果手动做的话效率非常低.这时候我可以这 ...

  7. 【bzoj2721】[Violet 5]樱花

    题目传送门:https://www.lydsy.com/JudgeOnline/problem.php?id=2721 好久没做数学题了,感觉有些思想僵化,走火入魔了. 这道题就是求方程$ \frac ...

  8. 一种不太合规的PreparedStatement使用方式

    这是一种不太合规的PreparedStatement调用使用方式 , 没有让Dao单独执行它单纯的任务. AccountDao.java package heartl_jdbc; /** * 银行操作 ...

  9. [BZOJ1877][SDOI2009]SuperGCD

    题目大意 求两个个高精度数的gcd 题目解析 在学习gcd的时候,书上就记载了"更相减损术"这一方法 基于这种方法,我们进行优化,使得我们能快速求出两个大数的gcd 对于 \(a, ...

  10. lxml.etree去除子节点

    去除etree中的某个子节点有两种方法: 1.parentnode.remove(node) 2.etree.strip_elements(html, 'element_name', with_tag ...