Blog Archive for July 25, 2012

HttpClient v3 Proxy

July 25, 2012

If you need to proxy HttpClient v3 calls through a proxy server, you can do it by setting the following after creating the HttpClient instance:

HttpClient lClient = new HttpClient();
lClient.getHostConfiguration().setProxy("proxyserver.domain.name", 3141);

HttpClient v3 HTTP Authentication

July 25, 2012

I needed to use HttpClient 3 to POST to a web service that was protected with HTTP security. This means I need to pass in the credentials as part of the call.

The following code was used for this:

String lServiceHost = lUrl.substring("https://".length()); …