Exemplo n.º 1
0
 @Override
 public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
   if (msg instanceof DefaultLastHttpContent) {
     DefaultLastHttpContent response = (DefaultLastHttpContent) msg;
     ctx.fireChannelRead(response.content());
   }
 }
Exemplo n.º 2
0
 private ChannelFuture sendLastChunk() {
   if (log.isDebugEnabled()) {
     log.debug("send: Sending last HTTP chunk");
   }
   DefaultLastHttpContent chunk = new DefaultLastHttpContent();
   if ((trailers != null) && !isOlderHttpVersion()) {
     for (Map.Entry<String, String> t : trailers) {
       chunk.trailingHeaders().add(t.getKey(), t.getValue());
     }
   }
   ChannelFuture ret = channel.write(chunk);
   return ret;
 }