channelIdle get messageevent
jsia24
jsia18 at gmail.com
Fri May 27 11:26:06 EDT 2011
Hi,
I created
public class IdleHandler extends IdleStateAwareChannelHandler {
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) {
HttpResponse response = new DefaultHttpResponse(HTTP_1_1, OK);
response.setContent(ChannelBuffers.copiedBuffer("TIME OUT",
CharsetUtil.UTF_8));
response.setHeader(CONTENT_TYPE, "text/plain; charset=UTF-8");
response.setHeader(CONTENT_LENGTH,
response.getContent().readableBytes());
ChannelFuture future = e.getChannel().write(response);
future.addListener(ChannelFutureListener.CLOSE);
}
}
I wanted to check if the request is keep alive so if yes I can send content
length, is there a way of doing it?
isKeepAlive(e.getMessage()); --> how do I getMessage from IdleStateEvent
Thanks,
Jason
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/channelIdle-get-messageevent-tp6411490p6411490.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list