Skip to content

Instantly share code, notes, and snippets.

@nickman
Last active April 5, 2016 10:09
Show Gist options
  • Save nickman/44fafb1fe06546b40c2dd96f0ca0f53f to your computer and use it in GitHub Desktop.
Save nickman/44fafb1fe06546b40c2dd96f0ca0f53f to your computer and use it in GitHub Desktop.
/**
* Modifies the pipeline to handle HTTP requests
* @param ctx The calling channel handler context
* @param maxRequestSize The maximum request size in bytes
*/
private void switchToHttp(final ChannelHandlerContext ctx, final int maxRequestSize) {
ChannelPipeline p = ctx.pipeline();
p.addLast("compressor", new HttpContentCompressor());
p.addLast("httpHandler", new HttpServerCodec()); // TODO: config ?
p.addLast("decompressor", new HttpContentDecompressor());
p.addLast("aggregator", new HttpObjectAggregator(maxRequestSize));
p.addLast("handler", rpchandler);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment