Hi

I have a thick client application which connects to a server on the internet
for file transmission and upload.

However, the access to the internet is via proxy. I am using HttpClient on
the thick client and Apache Commons file upload on the server side.

I am setting the proxy on the HttpClient as below:

HttpClient client = new  HttpClient(); 
HostConfiguration config = client.getHostConfiguration(); 
config.setProxy(PROXY_HOST, PROXY_PORT); 

PostMethod filePost = new PostMethod(servletPath);
int status = client.executeMethod(config , filePost);

However, instead of hardcoding values for PROXY_HOST, PROXY_PORT above, I am
using HttpUrlConnection to get the proxy information and set into these
values. This works fine.

If I dont set the proxy settings like this, HttpClient is ignoring my proxy
settings and not detecting them automatically and as a result my application
is not able to connect to the server on the internet.


Now when I connect to the server using HttpClient, the request goes via
proxy but fails as it expects user authentication credentials for the proxy
information provided. I am not able to figure out a way how to make this
work as I expected a popup for the user to enter user id and password, once
connected to the proxy instead of request failing altogether.

Can somebody suggest how to make HttpClient work with proxy without
hardcoding the PROXY_HOST, PROXY_PORT values. 
Also, this application will be launched from thick client for different
users. So the proxy information should be automatically detected from
browser settings (which is what the HttpUrlConnection is doing for me). 

Can somebody please suggest a solution for this scenario?

Thanks
Radhika
-- 
View this message in context: 
http://old.nabble.com/Proxy-authentication-problem-with-HttpClient-tp31427471p31427471.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to