hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Best way to deal with proxy servers from simple applet?
Date Sun, 22 Feb 2009 16:09:30 GMT
Scott Mueller wrote:
> Hi guys, I have a simple applet which is given a set of local files to
> upload to my server using HttpClient and MultipartEntity.  Basically when
> someone uploads a GEDCOM file (genealogy data), the images are specified as
> local files.  So I then present a signed applet to them to grab those files
> off their local filesystem.  This is the least intrusive and simplest way I
> could think of to get these images from users.
> 
> So what do I do about proxy servers?  Is there a way I can read from the
> browser if and how their proxy configuration is setup and then transfer that
> information to HttpClient in the applet?  Is it possible HttpClient does
> this automatically? 

Yes, it can. Configure HttpClient to use ProxySelectorRoutePlanner 
instead of the DefaultHttpRoutePlanner.

---
DefaultHttpClient httpclient = new DefaultHttpClient();

ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
         httpclient.getConnectionManager().getSchemeRegistry(),
         ProxySelector.getDefault());

httpclient.setRoutePlanner(routePlanner);
---

Oleg


  Are there standard system properties I can read to deal
> with this?  Are there any other situations I should be aware of, like proxy
> servers, that might prevent images from being uploaded?
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message