users@glassfish.java.net

Re: Problem with http.proxyhost

From: Alexis Moussine-Pouchkine <alexis.mp_at_sun.com>
Date: Wed, 16 Apr 2008 12:16:03 +0200

Salut Olivier,

Would Java 5's java.net.Proxy help here (per connection, not per
application)?
Something like:

             SocketAddress address = new
InetSocketAddress("myproxy.mynetwork.net", 8080);
             Proxy proxy = new Proxy(Proxy.Type.HTTP, address);
             URL serviceUrl = uri.toURL();
             URLConnection connection =
serviceUrl.openConnection(proxy);

I think proxy settings in domain.xml take precedence over the above
some make sure you don't have anything set there.
"proxy" is such an overloaded term....

thanks,
-Alexis


On Apr 16, 2008, at 9:32, Olivier Liechti wrote:
>
> Hello,
>
> I have a Java EE application, with a JSF front-end. In a backing
> bean, I
> want to fetch a URL and need the possibility to set the http proxy
> at the
> application level. So, I tried the following:
>
> System.setProperty("http.proxySet", "true");
> System.setProperty("http.proxyHost",
> "myproxy.mynetwork.net");
> System.setProperty("http.proxyPort", "8080");
>
> URI uri = new URI("http", url, null);
> URL serviceUrl = uri.toURL();
> BufferedReader br = new BufferedReader(new
> InputStreamReader(serviceUrl.openStream()));
>
> I get a "java.net.ConnectException: Operation timed out" exception. I
> sniffed the network traffic with wireshark and observed that the HTTP
> request does NOT go through the proxy...
>
> What am I am missing?
>
> Many thanks and best regards,
>
> Olivier
> --
> View this message in context: http://www.nabble.com/Problem-with-http.proxyhost-tp16718017p16718017.html
> Sent from the java.net - glassfish users mailing list archive at
> Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>