On Thu, 2013-06-06 at 18:25 +0200, Sebastiano Vigna wrote:
> It would be useful to be able to start an HTTP request towards a server
> specifying the IP address together with the request, so that no DNS
> resolution is performed (unless, of course, redirection handling is enabled).
>
> This effect can be obtained with a custom DNS resolution class, but for a
> number of reasons (typically, to avoid double caching) we would find useful
> to have a direct way to do it.
>
> Maybe there's a way and we missed it. Suggestions? Should I add a Jira issue?
>
What's wrong with using an explicit HttpHost with a resolved address?
---
CloseableHttpClient httpClient = HttpClients.createDefault();
HttpHost target = new HttpHost("173.194.40.20");
HttpGet httpGet = new HttpGet("http://www.google.com/");
CloseableHttpResponse httpResponse = httpClient.execute(
target, httpGet);
try {
System.out.println(httpResponse.getStatusLine());
} finally {
httpResponse.close();
}
---
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]