This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HttpPipelineFactory implements ChannelPipelineFactory { | |
private final ExecutionHandler executionHandler; | |
private final ProductDaoImpl productDao; | |
public HttpPipelineFactory(ProductDaoImpl productDao, | |
OrderedMemoryAwareThreadPoolExecutor eventExecutor) { | |
this.productDao = productDao; | |
this.executionHandler = new ExecutionHandler(eventExecutor); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void finish(ChannelHandlerContext channel, HttpResponse response, | |
RandomAccessFile gif, String contentType) { | |
ChannelFuture future = null; | |
try { | |
long fileLength = gif.length(); | |
response.headers().set(CONTENT_LENGTH, fileLength); | |
response.headers().set(CONTENT_TYPE, contentType); | |
future = channel.write(response); | |
DefaultFileRegion region = new DefaultFileRegion(gif.getChannel(), 0, |