Recently I wanted to access a site outside the firewall thru Apache commons HttpClient. The proxy server was using NTLM authentication.
Thankfully, HttpClient had support for NTLM authentication. Here's the code snippet for the same:
--------------------------------------------------------------
HostConfiguration hConf= httpClient.getHostConfiguration();
hConf.setProxy("proxy.mycompany.com", 8080);
httpClient.getState().setProxyCredentials(
new AuthScope("proxy.mycompany.com", 8080, "domainName"),
new NTCredentials("username", "password","my_localhost","domainName")
);
--------------------------------------------------------------
Thursday, April 12, 2007
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment