@Override protected void encode(ChannelHandlerContext ctx, NettyHttpResponse nettyResponse, List<Object> out) throws Exception { nettyResponse.getOutputStream().flush(); if (nettyResponse.isCommitted()) { out.add(LastHttpContent.EMPTY_LAST_CONTENT); } else { HttpResponse response = nettyResponse.getDefaultHttpResponse(); out.add(response); } }
public void finish() throws IOException { if (os != null) os.flush(); ChannelFuture future; if (isCommitted()) { // if committed this means the output stream was used. future = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } else { future = ctx.writeAndFlush(getEmptyHttpResponse()); } if(!isKeepAlive()) { future.addListener(ChannelFutureListener.CLOSE); } }
public void reset() { if (response.isCommitted()) throw new IllegalStateException(Messages.MESSAGES.responseIsCommitted()); buffer.clear(); }
@Override public void flush() throws IOException { int readable = buffer.readableBytes(); if (readable == 0) return; if (!response.isCommitted()) response.prepareChunkStream(); ctx.writeAndFlush(new DefaultHttpContent(buffer.copy())); buffer.clear(); super.flush(); }
public void finish() throws IOException { if (os != null) os.flush(); ChannelFuture future; if (isCommitted()) { // if committed this means the output stream was used. future = ctx.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } else { future = ctx.writeAndFlush(getEmptyHttpResponse()); } if(!isKeepAlive()) { future.addListener(ChannelFutureListener.CLOSE); } }
@Override protected void encode(ChannelHandlerContext ctx, NettyHttpResponse nettyResponse, List<Object> out) throws Exception { nettyResponse.getOutputStream().flush(); if (nettyResponse.isCommitted()) { out.add(LastHttpContent.EMPTY_LAST_CONTENT); } else { HttpResponse response = nettyResponse.getDefaultHttpResponse(); out.add(response); } }
public void reset() { if (response.isCommitted()) throw new IllegalStateException(Messages.MESSAGES.responseIsCommitted()); buffer.clear(); }
@Override public void flush() throws IOException { int readable = buffer.readableBytes(); if (readable == 0) return; if (!response.isCommitted()) response.prepareChunkStream(); ctx.writeAndFlush(new DefaultHttpContent(buffer.copy())); buffer.clear(); super.flush(); }