@Override
protected void initChannel(SocketChannel ch)
throws Exception {
// Create a default pipeline implementation.
CorsConfig corsConfig = CorsConfig.withAnyOrigin().build();
ChannelPipeline pipeline = ch.pipeline();
// Uncomment the following line if you want HTTPS
//SSLEngine engine = SecureChatSslContextFactory.getServerContext().createSSLEngine();
//engine.setUseClientMode(false);
//pipeline.addLast("ssl", new SslHandler(engine));
pipeline.addLast("encoder", new HttpResponseEncoder());
pipeline.addLast("decoder", new HttpRequestDecoder());
pipeline.addLast("aggregator", new HttpObjectAggregator(8388608)); // 8MB
//pipeline.addLast("chunkedWriter", new ChunkedWriteHandler());
pipeline.addLast("cors", new CorsHandler(corsConfig));
pipeline.addLast("handler", new HttpStaticFileServerHandler());
}
HttpStaticFileServerInitializer.java 文件源码
java
阅读 28
收藏 0
点赞 0
评论 0
项目:scratch_zookeeper_netty
作者:
评论列表
文章目录