httpClient proxy support in apache commons 3.1
- by user1173339
I am using apache commons 3.1 to implement httpClient with proxy support.
I am trying to connect to a remote host through proxy. The proxy server is configured without any authentication, however the the remote host is configured with authentication.
When I am passing the proxy parameters through properties file, it gives warning while execution:
WARN - Required proxy credentials not available for BASIC @xx.xx.xx.xx
WARN - Preemptive authentication requested but no default proxy credentials availble
But the execution goes ahead.
On the other hand when I am passing the proxy parameters through the JVM arguments then the again the same warning is given and the execution is stopped.
Is there any specific reason for this behavior? Is there any difference in passing the proxy parameters through properties file and through JVM arg?
Here is the code:
if(System.getProperty("http.proxyHost") != null && System.getProperty("http.proxyPort") != null) {
httpClient.getHostConfiguration().setProxy(System.getProperty("http.proxyHost"), Integer.parseInt(System.getProperty("http.proxyPort")));
}
else if(AMXAdminTask.props.getProperty("http.proxyHost") != null && AMXAdminTask.props.getProperty("http.proxyPort") != null) {
httpClient.getHostConfiguration().setProxy(Propfile.props.getProperty("http.proxyHost"), Integer.parseInt(Propfile.props.getProperty("http.proxyPort")));
}