hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Claassen <mclaas...@ocie.net>
Subject RE: HttpClient, SOCKS proxy, and webstart
Date Tue, 23 Jan 2007 18:44:31 GMT

Well, I have some good news for you.

Just running the JRE (like through an IDE) the ProxySelector.getDefault()
gives a ProxySelector class or sun.net.spi.DefaultProxySelector
Running through webstart gives class a ProxySelector class of
com.sun.deploy.net.proxy.DeployProxySelector

So, when running in webstart, you can use the
ProxySelector.getDefault().select(URI) to get a list of proxies.  For here,
it is easy to set the proxy in the 
org.apache.commons.httpclient.HostConfiguration.  For all the tests I have
performed, this works as expected.

So, now to restate what I was trying to say before:
As long as I set the proxy information in
org.apache.commons.httpclient.HostConfiguration, I don't need to create a
Socket with Socket(Proxy), I just need to create a socket using the values
in the createSocket method and and HttpClient will worry about the Proxy
stuff.

Thanks again,
Mark


-----Original Message-----
From: Roland Weber [mailto:ROLWEBER@de.ibm.com] 
Sent: Tuesday, January 23, 2007 12:28 PM
To: HttpClient User Discussion
Subject: RE: HttpClient, SOCKS proxy, and webstart

Hi Mark,

> The class sun.net.NetworkClient just basically creates a new socket 
> via
> Socket() or Socket(Proxy p).  Inefficiencies aside, could I just 
> create
a
> SocketFactory that just creates a new socket every time?

Yes you could. Efficiency is not a problem, you'll have to create a new
Socket object anyway.

> Since it seems
> that HttpClient manages the proxies and all that, it seems I would not
need
> to bother with that.

You do need to bother. HttpClient expects to be *told* which proxy to use.
That's for HTTP proxies. If "and all that" refers to SOCKS proxies,
HttpClient does not do anything with them. This has to be handled in the
socket factories. IIRC, standard sockets will pick up SOCKS settings that
are passed to the JVM as system properties. But I don't know what else
happens in web start.
The feature of web start to determine browser settings for SOCKS and HTTP
proxies is supposed to make your life easier. Unfortunately that happens
only if you use HttpURLConnection. I have no idea how you could get to the
browser settings for HTTP proxy in web start. If you find something out,
please let us know.

hope that helps,
  Roland



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


Mime
View raw message