Java : Character decoding failed.

信息 :org.apache.tomcat.util.http.Parameters [DirectJDKLog.java : 173] Character decoding failed. Parameter [param] with value [] has been ignored. Note that the name and value quoted here may be corrupted due to the failed decoding. Use debug level logging to see the original, non-corrupted values.
Note: further occurrences of Parameter errors will be logged at DEBUG level.

原因 :http接口请求,携带参数中含有%, 编码出错,导致数据传输为空。

解决 :param.replaceAll("%" , "%25");

补充 :

1.当发送参数数据类型为 "Content-Type", "application/x-www-form-urlencoded" 会出现此问题
2.当发送参数类型为 "Content-Type", "application/json" 接口使用@RequestBody接收入参 可以避免

 

posted @ 2021-10-14 18:29  _最初  阅读(1544)  评论(0编辑  收藏  举报