users@grizzly.java.net

Re: grizzly custom FilterChain

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Mon, 03 Oct 2011 16:58:30 -0700

Hi Peter,

you actually can execute FilterChain by calling:

ProcessorExecutor.execute(...) and pass FilterChain as a processor.
You can check our port unification module to get an idea how the
FilterChain switch may look like.

Hope it would help.

Thanks.

WBR,
Alexey.

On 10/03/2011 01:16 PM, Fodor Peter wrote:
> Hi everyone,
>
> I wrote a grizzly based message transfer protocol, and now I would
> like to port it to HTTP. (some of our customers have paranoid
> firewalls and proxies which let through only HTTP traffic). The base
> idea is using HTTP posts and long polling to transfer data fragments.
> (like websockets. Websocket is great technology, but it is blocked by
> proxies)
> I use the FilterChains and found them extremely useful, so I would
> like to use them. The dataflow is something like this: The HTTP
> requests arrive to FilterChain A and I would like to map and redirect
> their data to FilterChain B.
>
> FilterChain for real TCP connections:
> A: TransportFilter -> HTTPFilter -> Mapping requests to virtual connections
>
> FilterChain of virtual connections:
> B: SSLFilter -> GzipFilter -> Custom parser -> Custom protocol
>
> The problem is that I can not push data to FilterChain, because the
> API is protected and it uses Connection object for AttributeHolding
> etc. The message transfer protocol works with plain TCP sockets and
> with FilterChain B.
>
> I see some solutions, but none of them seems easy:
> 1. Dropping FilterChain B and reimplement SSL, Gzip and custom parser
> from zero (This is not a real option)
> 2. Using the TCP loopback connection to redirect data. (This seems
> easy, but it can not work on client PC, because of local firewalls)
> 3. Using java pipes as loopback interface (I'm working on this, but
> contains lot of copy-paste and refactor)
> 4. Reimplementing DefaultFilterChain and somehow push ByteBuffers to
> them (but every API is protected)
>
> Did you met such problem? Am I missing something obvious?
> How could I use FilterChain without a real connection?
>
> Thanks and best regards
> Peter