users@grizzly.java.net

Re: Port Unification in Grizzly HTTP server with custom TCP protocol

From: LongkerDandy <longkerdandy_at_gmail.com>
Date: Tue, 10 Jun 2014 10:34:55 +0800

Hi

It took me a day to identify the bug in my code.
I was doing: ctx.getAttributes().clear() in my filter and that result the
exception.

Thanks for your help, Alexey

Regards
LongkerDandy


On Mon, Jun 9, 2014 at 12:19 PM, Oleksiy Stashok <oleksiy.stashok_at_oracle.com
> wrote:

> The code looks fine. Are always able to reproduce the
> NullPointerException?
> Which Grizzly version are you using?
> Can you pls. make the testcase to reproduce the problem?
>
> Thanks.
>
> WBR,
> Alexey.
>
>
> On 08.06.14 21:13, LongkerDandy wrote:
>
> Hi
>
> I send is response in my filter, which is added to the PUProtocol.
> The code logic is like below:
>
> if (ctx != null && ctx.getConnection().isOpen()) {
> ctx.write(message, false);
> ctx.flush(new CompletionHandler<WriteResult>() {...});
> }
>
> The ctx is the FilterChainContext passed to Filter's handleRead method.
>
> Thanks
> LongkerDandy
>
>
> On Mon, Jun 9, 2014 at 11:27 AM, Oleksiy Stashok <
> oleksiy.stashok_at_oracle.com> wrote:
>
>> Hi,
>>
>> how do you send the response back?
>> Can you pls. share the code?
>>
>> Thanks.
>>
>> WBR,
>> Alexey.
>>
>>
>> On 08.06.14 20:04, LongkerDandy wrote:
>>
>> Hi
>>
>> I faced a problem with this setup.
>> When Server try to sendback message to Client in TCP, I got a
>> NullPointer Exception.
>> In both BackChannelFilter.hanlderWrite and handlerEvent.
>> Somehow ' puFilter.suspendedContextAttribute.get(ctx); ' seems return
>> null.
>>
>> Anything I am missing?
>>
>> Regards
>> LongkerDandy
>>
>>
>> On Sat, Jun 7, 2014 at 12:11 PM, Oleksiy Stashok <
>> oleksiy.stashok_at_oracle.com> wrote:
>>
>>> Hey,
>>>
>>> I've just added the sample
>>>
>>> https://github.com/GrizzlyNIO/grizzly-mirror/blob/2.3.x/samples/portunif/src/main/java/org/glassfish/grizzly/samples/portunif/HttpPUServer.java
>>>
>>> hope it will help.
>>>
>>> WBR,
>>> Alexey.
>>>
>>>
>>> On 05.06.14 21:20, LongkerDandy wrote:
>>>
>>> Hi
>>>
>>> Is it possible to re-use the same port(80) on both Grizzly HTTP Server
>>> <https://grizzly.java.net/httpserverframework.html> and a customer TCP
>>> protocol.
>>> I've read the offical document about Port Unification
>>> <https://grizzly.java.net/portunification.html>, but I can't found a
>>> HTTP Finder implementation.
>>> Even I write my own HTTP Finder, still I don't know how could this work
>>> with Grizzly HTTP Server.
>>>
>>> Regards
>>> LongkerDandy
>>>
>>>
>>>
>>
>>
>
>