@Override public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final InputStream is = inputStream; if (future.isStreamConsumed()) { if (is.markSupported()) is.reset(); else { LOGGER.warn("Stream has already been consumed and cannot be reset"); return; } } else { future.setStreamConsumed(true); } channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener( new WriteProgressListener(future, false, getContentLength()) { public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(is); super.operationComplete(cf); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT, channel.voidPromise()); } }
nettyBody = new NettyInputStreamBody(request.getStreamData()); nettyBody = new NettyInputStreamBody(inStreamGenerator.getInputStream(), inStreamGenerator.getContentLength());
nettyBody = new NettyInputStreamBody(request.getStreamData(), config); nettyBody = new NettyInputStreamBody(InputStreamBodyGenerator.class.cast(request.getBodyGenerator()).getInputStream(), config); else if (request.getBodyGenerator() instanceof ReactiveStreamsBodyGenerator) nettyBody = new NettyReactiveStreamsBody(ReactiveStreamsBodyGenerator.class.cast(request.getBodyGenerator()).getPublisher());
nettyBody = new NettyInputStreamBody(request.getStreamData(), config); nettyBody = new NettyInputStreamBody(InputStreamBodyGenerator.class.cast(request.getBodyGenerator()).getInputStream(), config);
@Override public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final InputStream is = inputStream; if (future.isStreamWasAlreadyConsumed()) { if (is.markSupported()) is.reset(); else { LOGGER.warn("Stream has already been consumed and cannot be reset"); return; } } else { future.setStreamWasAlreadyConsumed(true); } channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener( new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) { public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(is); super.operationComplete(cf); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } }
nettyBody = new NettyInputStreamBody(request.getStreamData(), config); nettyBody = new NettyInputStreamBody(InputStreamBodyGenerator.class.cast(request.getBodyGenerator()).getInputStream(), config);
@Override public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final InputStream is = inputStream; if (future.isStreamWasAlreadyConsumed()) { if (is.markSupported()) is.reset(); else { LOGGER.warn("Stream has already been consumed and cannot be reset"); return; } } else { future.setStreamWasAlreadyConsumed(true); } channel.write(new ChunkedStream(is), channel.newProgressivePromise()).addListener( new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) { public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(is); super.operationComplete(cf); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } }
nettyBody = new NettyInputStreamBody(request.getStreamData(), config); nettyBody = new NettyInputStreamBody(InputStreamBodyGenerator.class.cast(request.getBodyGenerator()).getInputStream(), config);