private boolean exitAfterHandlingBody(Channel channel, NettyResponseFuture<?> future, HttpResponse response, AsyncHandler<?> handler) throws Exception { if (!response.isChunked()) { // no chunks expected, exiting if (response.getContent().readableBytes() > 0) // FIXME no need to notify an empty bodypart? updateBodyAndInterrupt(future, handler, new NettyResponseBodyPart(response, null, true)); finishUpdate(future, channel, false); return true; } return false; }
private void handleChunk(HttpChunk chunk,// final Channel channel,// final NettyResponseFuture<?> future,// AsyncHandler<?> handler) throws IOException, Exception { boolean last = chunk.isLast(); // we don't notify updateBodyAndInterrupt with the last chunk as it's empty if (last || updateBodyAndInterrupt(future, handler, new NettyResponseBodyPart(null, chunk, last))) { // only possible if last is true if (chunk instanceof HttpChunkTrailer) { HttpChunkTrailer chunkTrailer = (HttpChunkTrailer) chunk; if (!chunkTrailer.trailingHeaders().isEmpty()) { NettyResponseHeaders responseHeaders = new NettyResponseHeaders(future.getHttpHeaders(), chunkTrailer.trailingHeaders()); handler.onHeadersReceived(responseHeaders); } } finishUpdate(future, channel, !chunk.isLast()); } }
NettyResponseBodyPart part = new NettyResponseBodyPart(null, webSocketChunk, frame.isFinalFragment()); handler.onBodyPartReceived(part);
private boolean exitAfterHandlingBody(Channel channel, NettyResponseFuture<?> future, HttpResponse response, AsyncHandler<?> handler) throws Exception { if (!response.isChunked()) { // no chunks expected, exiting if (response.getContent().readableBytes() > 0) // FIXME no need to notify an empty bodypart? updateBodyAndInterrupt(future, handler, new NettyResponseBodyPart(response, null, true)); finishUpdate(future, channel, false); return true; } return false; }
private void handleChunk(HttpChunk chunk,// final Channel channel,// final NettyResponseFuture<?> future,// AsyncHandler<?> handler) throws IOException, Exception { boolean last = chunk.isLast(); // we don't notify updateBodyAndInterrupt with the last chunk as it's empty if (last || updateBodyAndInterrupt(future, handler, new NettyResponseBodyPart(null, chunk, last))) { // only possible if last is true if (chunk instanceof HttpChunkTrailer) { HttpChunkTrailer chunkTrailer = (HttpChunkTrailer) chunk; if (!chunkTrailer.trailingHeaders().isEmpty()) { NettyResponseHeaders responseHeaders = new NettyResponseHeaders(future.getHttpHeaders(), chunkTrailer.trailingHeaders()); handler.onHeadersReceived(responseHeaders); } } finishUpdate(future, channel, !chunk.isLast()); } }
NettyResponseBodyPart part = new NettyResponseBodyPart(null, webSocketChunk, frame.isFinalFragment()); handler.onBodyPartReceived(part);