use of io.servicetalk.http.api.HttpRequestMethod in project servicetalk by apple.
the class NettyHttpServer method getChannelInitializer.
private static ChannelInitializer getChannelInitializer(final ByteBufAllocator alloc, final H1ProtocolConfig config, final CloseHandler closeHandler) {
// user-code. Therefore, ByteBufs must be copied to unpooled memory before HttpObjectDecoder.
return new CopyByteBufHandlerChannelInitializer(alloc).andThen(channel -> {
Queue<HttpRequestMethod> methodQueue = new ArrayDeque<>(2);
final ChannelPipeline pipeline = channel.pipeline();
final HttpRequestDecoder decoder = new HttpRequestDecoder(methodQueue, alloc, config.headersFactory(), config.maxStartLineLength(), config.maxHeaderFieldLength(), config.specExceptions().allowPrematureClosureBeforePayloadBody(), config.specExceptions().allowLFWithoutCR(), closeHandler);
pipeline.addLast(decoder);
pipeline.addLast(new HttpResponseEncoder(methodQueue, config.headersEncodedSizeEstimate(), config.trailersEncodedSizeEstimate(), closeHandler, decoder));
});
}
Aggregations