HttpAPIServer.java 文件源码

java
阅读 52 收藏 0 点赞 0 评论 0

项目:blynk-server 作者:
public HttpAPIServer(Holder holder) {
    super(holder.props.getProperty("listen.address"),
            holder.props.getIntProperty("http.port"), holder.transportTypeHolder);

    String adminRootPath = holder.props.getProperty("admin.rootPath", "/admin");

    final HttpAndWebSocketUnificatorHandler httpAndWebSocketUnificatorHandler =
            new HttpAndWebSocketUnificatorHandler(holder, port, adminRootPath);
    final LetsEncryptHandler letsEncryptHandler = new LetsEncryptHandler(holder.sslContextHolder.contentHolder);

    channelInitializer = new ChannelInitializer<SocketChannel>() {
        @Override
        protected void initChannel(SocketChannel ch) throws Exception {
            ch.pipeline()
            .addLast("HttpServerCodec", new HttpServerCodec())
            .addLast("HttpServerKeepAlive", new HttpServerKeepAliveHandler())
            .addLast("HttpObjectAggregator", new HttpObjectAggregator(holder.limits.webRequestMaxSize, true))
            .addLast(letsEncryptHandler)
            .addLast("HttpChunkedWrite", new ChunkedWriteHandler())
            .addLast("HttpUrlMapper", new UrlReWriterHandler("/favicon.ico", "/static/favicon.ico"))
            .addLast("HttpStaticFile", new StaticFileHandler(holder.props, new StaticFile("/static"),
                    new StaticFileEdsWith(CSVGenerator.CSV_DIR, ".csv.gz")))
            .addLast("HttpWebSocketUnificator", httpAndWebSocketUnificatorHandler);
        }
    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号