users@grizzly.java.net

Re: Closing a single connection while using keep alive

From: Oleksiy Stashok <oleksiy.stashok_at_oracle.com>
Date: Sun, 07 Jun 2015 13:33:03 +0200

Hi Ana,

httpResponsePacket.getProcessingState().setKeepAlive(false);
definitely will work, but anyway it's a bug, because "Connection: close"
should work as well.
Can you pls. file an issue?

Thanks.

WBR,
Alexey.

On 05.06.15 22:12, Ana Laura Felisatti wrote:
> Hi, there.
>
> I was wondering what is the proper or best way to close a connection
> while maintaining a general keep alive policy.
>
> We are creating a HttpServerFilter with a KeepAlive, so that
> connections are not closed unless they timeout. However, the response
> we generate could potentially include a "Connection: close" header, in
> which case we want the connection to close when the response is sent.
>
> I tried explicitly closing the connection using the FilterChainContext
> but I'm sure that will cause complications. I then tried this with the
> HttpResponsePacket we generate and that makes it to the
> prepareResponse method of HttpServerFilter:
>
> httpResponsePacket.getProcessingState().setKeepAlive(false);
>
> Is that the proper way?
>
> Thanks,
>
> --
> Ana Felisatti