A
Alex Hunsley
Anyone else had problems with setting the proxy credentials (i.e. username,
password) in Jakarta HttpClient 2.0?
Sorry, no complete code I could post at this time, but the important part looks
like this:
HttpClient httpClient = new HttpClient();
httpClient.getHostConfiguration().setProxy(proxyAddress, proxyPort);
httpState.setProxyCredentials(null, // realm - null is default
null, // proxy host
new UsernamePasswordCredentials("usernameHere", "passwordHere"));
[[... then use HttpClient to access a web page using Post method]]
The second line, i.e. the setting of the proxy host and port, works. My test
proxy server (using Charles: http://www.xk72.com/charles/) does get used.
Howver, the last line, where I set the proxy credentials, has no effect - the
credentials don't get supplied to the proxy. AFAICT from the docs on
HttpClient, a null realm and null proxy host are the right way to specify the
default proxy credentials, can anyone comment on this?
(Btw, I've tested my proxy server (Charles) by using wget, and when I set proxy
credentials when using wget, they do show up in Charles, so it's not a case of
my proxy server just not telling me when credentials have been supplied!)
I am going mad here so any help appreciated!
thanks
alex
password) in Jakarta HttpClient 2.0?
Sorry, no complete code I could post at this time, but the important part looks
like this:
HttpClient httpClient = new HttpClient();
httpClient.getHostConfiguration().setProxy(proxyAddress, proxyPort);
httpState.setProxyCredentials(null, // realm - null is default
null, // proxy host
new UsernamePasswordCredentials("usernameHere", "passwordHere"));
[[... then use HttpClient to access a web page using Post method]]
The second line, i.e. the setting of the proxy host and port, works. My test
proxy server (using Charles: http://www.xk72.com/charles/) does get used.
Howver, the last line, where I set the proxy credentials, has no effect - the
credentials don't get supplied to the proxy. AFAICT from the docs on
HttpClient, a null realm and null proxy host are the right way to specify the
default proxy credentials, can anyone comment on this?
(Btw, I've tested my proxy server (Charles) by using wget, and when I set proxy
credentials when using wget, they do show up in Charles, so it's not a case of
my proxy server just not telling me when credentials have been supplied!)
I am going mad here so any help appreciated!
thanks
alex