users@jax-ws.java.net

Re: JAX-WS and HTTP Proxies

From: Derick Potgieter <derick.potgieter_at_gmail.com>
Date: Mon, 8 May 2006 09:32:06 +0200

Hi Brad,

I was struggling with this just the other day...but how would i get the
webservice to actually use this?

On 5/6/06, Brad Peabody <bradpeabody_at_scientology.net> wrote:
>
> A simple point, but it would probably be useful to make a mention
> somewhere in
> the JAX-WS-RI docs that you can setup a web service to use an HTTP proxy
> using
> the java.net.ProxySelector facility.
>
> I spent quite some time digging around to find this. I know that this is
> not
> a JAX-WS specific point and is just part of the overall JSE API, but
> still, in
> my case I didn't even think to look in the java.net package until I had
> exhausted my googling and had dug into the JAX-WS-RI source, etc. (I
> didn't
> even know about ProxySelector as I'd been using other HTTP clients like
> Apache
> Commons HttpClient, etc.)
>
> Here's the sample code I used to get it up and running:
>
>
> public static class LocatorManagerProxySelector extends ProxySelector
> {
> public List<Proxy> select(URI uri) {
> List<Proxy> myList = new ArrayList<Proxy>();
> myList.add(new Proxy(Type.HTTP,
> new InetSocketAddress("PROXY_HOST", 8008)));
> return myList;
> }
>
> public void connectFailed(URI uri,
> SocketAddress sa,
> IOException ioe) {
> }
> }
>
> public static void METHOD_HERE() throws Exception {
>
> ProxySelector.setDefault(new LocatorManagerProxySelector());
>
> ...
>
> }
>
>
> Minor point, but it might help others to just mention it somewhere.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>