users@glassfish.java.net

Re: WebSockets and proxy-servers

From: Justin Lee <justin.d.lee_at_oracle.com>
Date: Tue, 17 May 2011 10:25:37 -0400

HttpUrlConnection does not allow you set header fields on the request.
WebSockets really are not HTTP. They just use the upgrade facility to
piggy back their way into existing servers and firewalls. I created an
issue to track this (http://java.net/jira/browse/GRIZZLY-1012). I'll do
my best to get that in soon. I'm in the middle refactoring for the new
draft spec, though, so it might not be tomorrow. :) Feel free to
comment on/follow that issue, though.

On 5/16/11 11:54 AM, forums_at_java.net wrote:
> Hi, thank you for the reply, I posted it in the forums, but here it is:
>
> [quote=MohamzJava]
>
> Hi,
>
> this question could be wrong here, since it is in the grizzly part,
> but since
> grizzly is integrated in GlassFish, perhaps someone could help...
>
> Well, I'm using a Java (swing) client to access my server using
> websockets,
> everything is working fine.
>
> Now I have a task to make sure that it also works throw a
> proxy-server, so
> after some research I know that using wss is the right thing to do. Still
> evrything fine here, I can connect (directly) to my server through wss.
>
> Now comes the problem:
>
> How can I tell my client to use a defined proxy-server? I tried first the
> Plain Old Java Procedure(c) ;)
>
> System.setProperty("https.proxyHost", proxyHost) ;
> System.setProperty("https.proxyPort", proxyPort) ;
>
> But the client is still contacting the server directly (proxy not
> loggin any
> connection from client).
>
> Then I tried using the ProxySelector:
>
> But using a Http Proxy Def is not functioning:
>
> new Proxy(Proxy.Type.HTTP, inetSocketAddress);
>
> When I debug the client, in my MyProxySelector.select(URI uri) I get for
>
> uri.getScheme();
>
> "socket" instead of Http, so registering a Proxy with Proxy.Type.HTTP is
> wrong.
>
> Why is it that the Grizzly implementation of WebSockets uses "socket"
> protocol instead of http? Shouldn't WebSocket work over Http?
>
> And most importantly how can I define a proxy-server for my connection?
>
> Thank you in advance!
>
> Regards,
>
> MohamzJava
>
> [/quote]
>
>
> --
>
> [Message sent by forum member 'MohamzJava']
>
> View Post: http://forums.java.net/node/800926
>
>