Example usage for io.netty.handler.codec.http2 CompressorHttp2ConnectionEncoder DEFAULT_MEM_LEVEL

List of usage examples for io.netty.handler.codec.http2 CompressorHttp2ConnectionEncoder DEFAULT_MEM_LEVEL

Introduction

In this page you can find the example usage for io.netty.handler.codec.http2 CompressorHttp2ConnectionEncoder DEFAULT_MEM_LEVEL.

Prototype

int DEFAULT_MEM_LEVEL

To view the source code for io.netty.handler.codec.http2 CompressorHttp2ConnectionEncoder DEFAULT_MEM_LEVEL.

Click Source Link

Usage

From source file:io.vertx.core.http.impl.VertxHttp2ConnectionHandlerBuilder.java

License:Open Source License

@Override
protected VertxHttp2ConnectionHandler<C> build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
        Http2Settings initialSettings) throws Exception {
    if (isServer()) {
        if (useCompression) {
            encoder = new CompressorHttp2ConnectionEncoder(encoder, compressionLevel,
                    CompressorHttp2ConnectionEncoder.DEFAULT_WINDOW_BITS,
                    CompressorHttp2ConnectionEncoder.DEFAULT_MEM_LEVEL);
        }/*w w w .j  ava  2 s.c o  m*/
        VertxHttp2ConnectionHandler<C> handler = new VertxHttp2ConnectionHandler<>(connectionMap, decoder,
                encoder, initialSettings, connectionFactory);
        if (useDecompression) {
            frameListener(new DelegatingDecompressorFrameListener(decoder.connection(), handler.connection));
        } else {
            frameListener(handler.connection);
        }
        return handler;
    } else {
        VertxHttp2ConnectionHandler<C> handler = new VertxHttp2ConnectionHandler<>(connectionMap, decoder,
                encoder, initialSettings, connectionFactory);
        if (useCompression) {
            frameListener(new DelegatingDecompressorFrameListener(decoder.connection(), handler.connection));
        } else {
            frameListener(handler.connection);
        }
        return handler;
    }
}