Use HttpGet with illegal characters in the URL

Posted by kaciula on Stack Overflow See other posts from Stack Overflow or by kaciula
Published on 2010-05-27T17:42:38Z Indexed on 2010/05/27 17:51 UTC
Read the original article Hit count: 516

Filed under:
|
|
|
|

I am trying to use DefaultHttpClient and HttpGet to make a request to a web service. Unfortunately the web service URL contains illegal characters such as { (ex: domain.com/service/{username}). It's obvious that the web service naming isn't well written but I can't change it.

When I do HttpGet(url), I get that I have an illegal character in the url (that is { and }). If I encode the URL before that, there is no error but the request goes to a different URL where there is nothing.

The url, although has illegal characters, works from the browser but the HttpGet implementation doesn't let me use it. What should I do or use instead to avoid this problem?

© Stack Overflow or respective owner

Related posts about java

Related posts about http