I am trying to execute the following link using following code:
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)
Whereas there's no error for given below URL which has no gaps in words of "msg="
String url="http://<server>/<path>/action=send&msg=newmessage";
How can I resolve the issue of gap in words in URL?
See Question&Answers more detail:os