use of com.duangframework.server.netty.handler.HttpBaseHandler in project duangframework by tcrct.
the class HttpChannelInitializer method initChannel.
@Override
protected void initChannel(SocketChannel ch) throws Exception {
ChannelPipeline p = ch.pipeline();
if (bootStrap.isSslEnabled()) {
sslContext = bootStrap.getSslContext();
}
// HttpServerCodec包含了默认的HttpRequestDecoder(请求消息解码器)和HttpResponseEncoder(响应解码器)
p.addLast(new HttpServerCodec());
// 为http响应内容添加gizp压缩器
p.addLast(new HttpContentCompressor());
// 目的是将多个消息转换为单一的request或者response对象
p.addLast(new HttpObjectAggregator(1048576));
// 目的是支持异步大文件传输
p.addLast(new ChunkedWriteHandler());
// 真正处理HTTP业务逻辑的地方,针对每个TCP连接创建一个新的ChannelHandler实例
p.addLast(new HttpBaseHandler(bootStrap));
}
Aggregations