First, thank you all for this wonderful httpclient library. I found it this weekend, and started to test the functionalities that I want. It works very nicely except I could not figure out how to configurate a proxy server. I really need to access internet using this httpclient through my company's proxy server.
I know the following codes work in Proxy configuration when I use JDK's URLConnection:
------------ System.getProperties().put("proxySet", "true"); System.getProperties().put("proxyHost", "www-ad-proxy.mycompany.com"); System.getProperties().put("proxyPort", "80"); URL url=new URL("some-url"); URLConnection conn=url.openConnection(); String authString="myusername:mypassword"; BASE64Encoder encoder=new BASE64Encoder(); String auth="Basic "+encoder.encode(authString.getBytes()); conn.setRequestProperty("Proxy-Authorization", auth); ------------
I tried to do a get method using this httpclient module as following ---------
HttpClient client=new HttpClient(); HostConfiguration hostConfig=new HostConfiguration(); hostConfig.setProxy("www-ad-proxy.mycompany.com",80); HttpState state=new HttpState(); UsernamePasswordCredentials userpass= new UsernamePasswordCredentials("myname","mypass"); state.setProxyCredentials(null, null, userpass); client.setHostConfiguration(hostConfig); client.setState(state); GetMethod method=new GetMethod("http://www.apache.org"); .... -----
It did not work. The warning message was:
[WARN] HttpMethodBase - -Credentials cannot be used for NTLM authentication: myname:mypass
Please help me
Thanks Mike
_________________________________________________________________ MSN 8: Get 6 months for $9.95/month. http://join.msn.com/?page=dept/dialup
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]