I want to make an http query using the java http client (HttpClient). The server I am querying is a service on Docker to which I can access with its service name.
Here is my code :
URIBuilder uriBuilder = new URIBuilder()
.setScheme("http")
.setHost("my_docker_service_name:5000" + "/balance/")
.setParameter("account_id", "1")
.setParameter("timestamp", "1596637676")
;
HttpRequest httpRequest = HttpRequest.newBuilder()
.GET()
.uri(uriBuilder.build())
.build();
With this I get the following error :
java.lang.IllegalArgumentException: unsupported URI http://my_docker_service_name:5000/?account_id=1×tamp=1596637676
If I replace my_docker_service_name
by an ipv4 address, the http request works as expected.
Do you see what I might be doing wrong ?
Many thanks for your help