I am trying to process the following URL via the HttpGet() method:
https://graph.facebook.com/search?q=Cafe++Bakery&type=event&access_token=&type=event&access_token=239090718395|lqqOnRWlcJOb3QGp3G4HW2aqhlc.
And I get the following exception:
java.lang.IllegalArgumentException:
Invalid uri 'https://graph.facebook.com/search?q=Cafe++Bakery&type=event&access_token=&type=event&access_token=239090718395|lqqOnRWlcJOb3QGp3G4HW2aqhlc.': Invalid query
at org.apache.commons.httpclient.HttpMethodBase.<init>(HttpMethodBase.java:222)
at org.apache.commons.httpclient.methods.GetMethod.<init>(GetMethod.java:89)
Now when I cut & paste that URL into the browswer it works just fine. I am
guess it is some sort of URL Encoding that needs to occur, but I am not sure what I have to change to call url from Http Client.
Thanks in advance.
Use URLEncoder.encode() to encode the URL