use of io.netty.handler.codec.http2.DefaultHttp2HeadersDecoder in project rest.li by linkedin.
the class Http2StreamCodecBuilder method build.
@Override
public Http2StreamCodec build() {
ObjectUtil.checkNotNull(_connection, "connection");
ObjectUtil.checkPositive(_maxHeaderSize, "maxHeaderSize");
Http2HeadersDecoder headerDecoder = new DefaultHttp2HeadersDecoder(_maxHeaderSize, Http2CodecUtil.DEFAULT_HEADER_TABLE_SIZE, isValidateHeaders(), INITIAL_HUFFMAN_DECODE_CAPACITY);
Http2FrameReader reader = new DefaultHttp2FrameReader(headerDecoder);
Http2FrameWriter writer = new DefaultHttp2FrameWriter(headerSensitivityDetector());
if (frameLogger() != null) {
reader = new Http2InboundFrameLogger(reader, frameLogger());
writer = new Http2OutboundFrameLogger(writer, frameLogger());
}
Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(_connection, writer);
boolean encoderEnforceMaxConcurrentStreams = encoderEnforceMaxConcurrentStreams();
if (encoderEnforceMaxConcurrentStreams) {
if (_connection.isServer()) {
encoder.close();
reader.close();
throw new IllegalArgumentException("encoderEnforceMaxConcurrentStreams: " + encoderEnforceMaxConcurrentStreams + " not supported for server");
}
encoder = new StreamBufferingEncoder(encoder);
}
Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(_connection, encoder, reader);
super.codec(decoder, encoder);
return super.build();
}
Aggregations