users@glassfish.java.net

Re: Using grizzly and coyote to create a simple SOAP bridge server

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Thu, 15 Feb 2007 15:23:33 -0500

Hi Jeff,

glassfish_at_javadesktop.org wrote:
> I am attempting to create a simple SOAP bridge server, but am stuck on how to appropriately connect my two ports together.
>
> My server starts two grizzly SelectorThreads on ports 9000 and 9001, using adapters org.apache.coyote.Adapter. Then from inside a firewall, I create a tunnel to to my bridge server on port 9000.
>
> How do I connect the request coming into port 9000 to the tunnel open on port 9001, so as to invoke services inside of the firewall? I think the appropriate place to perform this is in my adapter service(req, res) method, but from here I am stuck.
>
> Any ideas?

Are the two SelectorThread co-located inside the same VM? If not, then
you need to buffer all the bytes received on port 9000, open a
SocketChannel to port 9001, and flush out all the buffered bytes. The
SocketChannel between port 9000 and 9001 should be persistent, meaning
you open it and push as many request as you can on it (avoid opening it
and then closing it). I can send you a code snippet if that's the case.

If both Selector are colocated on the same VM, something like:

// From 9000, lookup 9001
SelectorThread.getSelector(9001).getAdapter().service(req,res);
SelectorThread.getSelector(9001).getAdapter().afterService(req,res);

Would that make sense?

Thanks

-- Jeanfrancois


>
>
> Jeff
> [Message sent by forum member 'tblack' (tblack)]
>
> http://forums.java.net/jive/thread.jspa?messageID=203939
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>