nettyBody = new NettyFileBody(request.getFile(), config); nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);
@Override public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "r"); try { ChannelFuture writeFuture; if (ChannelManager.isSslHandlerConfigured(channel.pipeline()) || config.isDisableZeroCopy()) { writeFuture = channel.write(new ChunkedFile(raf, offset, length, config.getChunkedFileChunkSize()), channel.newProgressivePromise()); } else { FileRegion region = new DefaultFileRegion(raf.getChannel(), offset, length); writeFuture = channel.write(region, channel.newProgressivePromise()); } writeFuture.addListener(new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) { public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(raf); super.operationComplete(cf); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } catch (IOException ex) { closeSilently(raf); throw ex; } } }
@Override public void write(Channel channel, NettyResponseFuture<?> future) throws IOException { final RandomAccessFile raf = new RandomAccessFile(file, "r"); try { ChannelFuture writeFuture; if (ChannelManager.isSslHandlerConfigured(channel.pipeline()) || config.isDisableZeroCopy()) { writeFuture = channel.write(new ChunkedFile(raf, offset, length, config.getChunkedFileChunkSize()), channel.newProgressivePromise()); } else { FileRegion region = new DefaultFileRegion(raf.getChannel(), offset, length); writeFuture = channel.write(region, channel.newProgressivePromise()); } writeFuture.addListener(new ProgressListener(config, future.getAsyncHandler(), future, false, getContentLength()) { public void operationComplete(ChannelProgressiveFuture cf) { closeSilently(raf); super.operationComplete(cf); } }); channel.writeAndFlush(LastHttpContent.EMPTY_LAST_CONTENT); } catch (IOException ex) { closeSilently(raf); throw ex; } } }
nettyBody = new NettyFileBody(request.getFile(), config); nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);
nettyBody = new NettyFileBody(request.getFile(), config); nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);
nettyBody = new NettyFileBody(request.getFile(), config); nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);
nettyBody = new NettyFileBody(request.getFile(), config); nettyBody = new NettyFileBody(fileBodyGenerator.getFile(), fileBodyGenerator.getRegionSeek(), fileBodyGenerator.getRegionLength(), config);