public class HttpServerKeepAliveHandler
extends io.netty.channel.ChannelDuplexHandler
The server channel is expected to set the proper 'Connection' header if it can handle persistent connections. HttpServerKeepAliveHandler will automatically close the channel for any LastHttpContent that corresponds to a client
request for closing the connection, or if the HttpResponse associated with that LastHttpContent requested closing the
connection or didn't have a self defined message length.
Since HttpServerKeepAliveHandler expects HttpObjects it should be added after HttpServerCodec
but before any other handlers that might send a HttpResponse.
ChannelPipelinep = ...; ... p.addLast("serverCodec", newHttpServerCodec()); p.addLast("httpKeepAlive", newHttpServerKeepAliveHandler()); p.addLast("aggregator", newHttpObjectAggregator(1048576)); ... p.addLast("handler", new HttpRequestHandler());
| Constructor and Description |
|---|
HttpServerKeepAliveHandler() |
| Modifier and Type | Method and Description |
|---|---|
void |
channelRead(io.netty.channel.ChannelHandlerContext ctx,
Object msg) |
void |
write(io.netty.channel.ChannelHandlerContext ctx,
Object msg,
io.netty.channel.ChannelPromise promise) |
bind, close, connect, deregister, disconnect, flush, readchannelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught, userEventTriggeredhandlerAdded, handlerRemoved, isSharableCopyright © 2008–2017 The Netty Project. All rights reserved.