Author: Frederik Heremans
(2009/03/27 15:58) About 3 years ago
Proxy authentication bug fixed
22
credentials = new UsernamePasswordCredentials(username, password);
23
}
24
state = new HttpState();
25
state.setCredentials(AuthScope.ANY, credentials);
state.setProxyCredentials(AuthScope.ANY, credentials);
26
27
28
public HostConfiguration getHostConfiguration() {
...
54
55
public HttpState getHttpState() {
56
HttpState newState = new HttpState();
57
newState.setCredentials(AuthScope.ANY, state.getCredentials(AuthScope.ANY));
newState.setProxyCredentials(AuthScope.ANY, state.getProxyCredentials(AuthScope.ANY));
58
return newState;
59
60
// Get the hostConfiguration
HostConfigurationWrapper wrapper = hostConfigurationFactory
.getHostConfigurationForHost(hostName);
61
62
// Execute the method
63
httpClient.getParams().setAuthenticationPreemptive(true);
httpClient.executeMethod(wrapper.getHostConfiguration(), method,
64
wrapper.getHttpState());
65
66
state.setProxyCredentials(AuthScope.ANY, credentials);public HostConfiguration getHostConfiguration() {public HostConfiguration getHostConfiguration() {public HttpState getHttpState() {public HttpState getHttpState() {newState.setCredentials(AuthScope.ANY, state.getCredentials(AuthScope.ANY));newState.setProxyCredentials(AuthScope.ANY, state.getProxyCredentials(AuthScope.ANY));