Advertisement
ferics2

Apache HttpClient HttpGet url with colon

May 20th, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.35 KB | None | 0 0
  1. String id = "{\"ID\":\"John Doe\"}";
  2. id = id.replace(":","%3A");
  3. String encodedID = URLEncoder.encode(id, "UTF-8").replace("+", "%20");
  4. endpoint="https://127.0.0.1/getResourceNameToUse?id=" + encodedID;
  5. HttpResponse response = new HttpResponse();
  6. HttpGet httpget = new HttpGet(endpoint);
  7. response = httpclient.execute(httpget, new RESTResponseHandler());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement