首页 新闻 搜索 专区 学院

这是什么问题各位大神java.lang.IllegalArgumentException: Illegal character in query at index 50:

0
悬赏园豆:5 [已解决问题] 解决于 2017-05-12 10:42

各位大神  急求!!!这是是什么问题!!!!!!!!!

java.lang.IllegalArgumentException: Illegal character in query at index 50: http://localhost:7777/LOAN//mobileuser/uploadYyzz?{"all":{"log_id":784676560,"words_result":[{"words":"7//mM2"},{"words":"品a新浪娱乐"}],"words_result_num":2,"direction":0}}
at java.net.URI.create(URI.java:852)
at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
at controller.HttpUtil.get(HttpUtil.java:78)
at controller.CheckImageController.exePosts(CheckImageController.java:106)
at controller.CheckImageController.validate(CheckImageController.java:87)
at controller.CheckImageController.doPost(CheckImageController.java:46)
at controller.CheckImageController.doGet(CheckImageController.java:39)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at filter.EncodingFilter.doFilter(EncodingFilter.java:30)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.URISyntaxException: Illegal character in query at index 50: http://localhost:7777/LOAN//mobileuser/uploadYyzz?{"all":{"log_id":784676560,"words_result":[{"words":"7//mM2"},{"words":"品a新浪娱乐"}],"words_result_num":2,"direction":0}}
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parseHierarchical(URI.java:3111)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:588)
at java.net.URI.create(URI.java:850)
... 30 more

lc_smile36的主页 lc_smile36 | 初学一级 | 园豆:199
提问于:2017-05-10 10:18
< >
分享
最佳答案
0

参数不能这么传吧,格式应该是a=xxx&b=xxx

如果你要传json格式,要进行转化一下

收获园豆:5
狼爷 | 小虾三级 |园豆:1197 | 2017-05-10 11:02
其他回答(3)
0

索引50中查询的非法字符 这个是 翻译过来的 你看看 是否有字符 使用错了 {"all":{"log_id":784676560,"words_result":[{"words":"7//mM2"},{"words":"品a新浪娱乐"}],"words_result_num":2,"direction":0}}

Ankermaker | 园豆:251 (菜鸟二级) | 2017-05-10 10:23
0

少了一个参数

lc_smile36 | 园豆:199 (初学一级) | 2017-05-10 10:57
0

HttpGet或 HttpPost都不能传包含 " 、“{"、"}"这样的参数,需要对特殊字符进行转义 空格也需要转义

  • ("\"", "%22")  
  • ("{", "%7b")
  • ("}", "%7d")

java里面有UrlEncoder类

吉吉的城 | 园豆:566 (小虾三级) | 2017-05-10 21:11
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册