NettyUtil.java 文件源码

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

项目:intellij-ce-playground 作者:
public static void addHttpServerCodec(@NotNull ChannelPipeline pipeline) {
  pipeline.addLast("httpRequestEncoder", new HttpResponseEncoder());
  // https://jetbrains.zendesk.com/agent/tickets/68315
  pipeline.addLast("httpRequestDecoder", new HttpRequestDecoder(16 * 1024, 16 * 1024, 8192));
  pipeline.addLast("httpObjectAggregator", new HttpObjectAggregator(MAX_CONTENT_LENGTH));
  // could be added earlier if HTTPS
  if (pipeline.get(ChunkedWriteHandler.class) == null) {
    pipeline.addLast("chunkedWriteHandler", new ChunkedWriteHandler());
  }
  pipeline.addLast("corsHandler", new CorsHandlerDoNotUseOwnLogger(CorsConfig
                                                                     .withAnyOrigin()
                                                                     .allowCredentials()
                                                                     .allowNullOrigin()
                                                                     .allowedRequestMethods(HttpMethod.GET, HttpMethod.POST, HttpMethod.PUT, HttpMethod.DELETE, HttpMethod.HEAD, HttpMethod.PATCH)
                                                                     .allowedRequestHeaders("origin", "accept", "authorization", "content-type")
                                                                     .build()));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号