users@glassfish.java.net

Re: Problem with http.proxyhost

From: Olivier Liechti <olivier.liechti_at_heig-vd.ch>
Date: Wed, 16 Apr 2008 05:23:11 -0700 (PDT)

Salut Alexis,

Actually, I had tried that, but without more success. I then figured out
that the problem was on my network. We have a load balanced HTTP proxy
(myproxy is an alias for myproxy-1 and myproxy-2). For some reason,
myproxy-1 was not accepting requests. After using myproxy-2, everything
worked as expected.

The surprising behavior is that if the URLConnection is unable to go through
the specified proxy, then it will try to go directly to destination (which
in my case was of course blocked by the firewall).

Cheers,

Olivier



alexismp wrote:
>
> 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
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
>

-- 
View this message in context: http://www.nabble.com/Problem-with-http.proxyhost-tp16718017p16721262.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.