【发布时间】:2011-03-14 06:12:34
【问题描述】:
我正在尝试使用以下代码执行以下链接:
class httpget{
HttpGet httpGet=null;
public void linkexecute(){
String url="http://<server>/<path>/action=send&msg=new message";
httpGet= new HttpGet(url); // line 1
....
}
at line 1 it is giving error "Illegal arguement exception"
java.lang.IllegalArgumentException: Illegal character in query at index 77: http://<server>/<path>/sms.json?action=send&msg=new message
at java.net.URI.create(URI.java:970)
at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:75)
at com.sms.login.LoginService.sendSms(LoginService.java:143)
而下面给出的 URL 没有错误,在 "msg="
的单词中没有间隙String url="http://<server>/<path>/action=send&msg=newmessage";
如何解决网址中的字间距问题?
【问题讨论】: