use of io.micronaut.http.netty.stream.StreamingInboundHttp2ToHttpAdapter in project micronaut-core by micronaut-projects.
the class DefaultHttpClient method newHttp2ConnectionHandlerBuilder.
/**
* Creates a new {@link HttpToHttp2ConnectionHandlerBuilder} for the given HTTP/2 connection object and config.
*
* @param connection The connection
* @param configuration The configuration
* @param stream Whether this is a stream request
* @return The {@link HttpToHttp2ConnectionHandlerBuilder}
*/
@NonNull
protected HttpToHttp2ConnectionHandlerBuilder newHttp2ConnectionHandlerBuilder(@NonNull Http2Connection connection, @NonNull HttpClientConfiguration configuration, boolean stream) {
final HttpToHttp2ConnectionHandlerBuilder builder = new HttpToHttp2ConnectionHandlerBuilder();
builder.validateHeaders(true);
final Http2FrameListener http2ToHttpAdapter;
if (!stream) {
http2ToHttpAdapter = new InboundHttp2ToHttpAdapterBuilder(connection).maxContentLength(configuration.getMaxContentLength()).validateHttpHeaders(true).propagateSettings(true).build();
} else {
http2ToHttpAdapter = new StreamingInboundHttp2ToHttpAdapter(connection, configuration.getMaxContentLength());
}
return builder.connection(connection).frameListener(new DelegatingDecompressorFrameListener(connection, http2ToHttpAdapter));
}
use of io.micronaut.http.netty.stream.StreamingInboundHttp2ToHttpAdapter in project micronaut-core by micronaut-projects.
the class NettyHttpServer method newHttpToHttp2ConnectionHandler.
private HttpToHttp2ConnectionHandler newHttpToHttp2ConnectionHandler() {
Http2Connection connection = new DefaultHttp2Connection(true);
final Http2FrameListener http2ToHttpAdapter = new StreamingInboundHttp2ToHttpAdapter(connection, (int) serverConfiguration.getMaxRequestSize(), serverConfiguration.isValidateHeaders(), true);
final HttpToHttp2ConnectionHandlerBuilder builder = new HttpToHttp2ConnectionHandlerBuilder().frameListener(http2ToHttpAdapter).validateHeaders(serverConfiguration.isValidateHeaders()).initialSettings(serverConfiguration.getHttp2().http2Settings());
serverConfiguration.getLogLevel().ifPresent(logLevel -> builder.frameLogger(new Http2FrameLogger(logLevel, NettyHttpServer.class)));
return builder.connection(connection).build();
}
Aggregations