查询URI语法中的非法字符

时间:2014-08-07 10:38:11

标签: java url

Illegal character in query at index 127: http://192.168.1.7:8080/service-0.0.1-SNAPSHOT/report/genReport/generateReport?reportname=REPORT&doctype=PDF&param={"StartDate":"20140604","EndDate":"20140630","Range":"10"}

任何人都可以帮助我摆脱这个错误

2 个答案:

答案 0 :(得分:0)

你应该对JSON进行urlencode

{"StartDate":"20140604","EndDate":"20140630","Range":"10"}

%7B%22StartDate%22%3A%2220140604%22%2C%22EndDate%22%3A%2220140630%22%2C%22Range%22%3A%2210%22%7D    

该网址将为

http://192.168.1.7:8080/service-0.0.1-SNAPSHOT/report/genReport/generateReport?reportname=REPORT&doctype=PDF&param=%7B%22StartDate%22%3A%2220140604%22%2C%22EndDate%22%3A%2220140630%22%2C%22Range%22%3A%2210%22%7D

答案 1 :(得分:-2)

您正尝试通过“获取请求”发送JSON对象。

您应该尝试POST方法。

对于HTTP客户端&发布方法,Check this link

相关问题