Example usage for io.netty.handler.codec.http2 Http2ConnectionHandler decoder

List of usage examples for io.netty.handler.codec.http2 Http2ConnectionHandler decoder

Introduction

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

Prototype

Http2ConnectionDecoder decoder

To view the source code for io.netty.handler.codec.http2 Http2ConnectionHandler decoder.

Click Source Link

Usage

From source file:com.linecorp.armeria.server.http.HttpServerPipelineConfigurator.java

License:Apache License

private Http2ConnectionHandler newHttp2ConnectionHandler(ChannelPipeline pipeline) {

    final Http2Connection conn = new DefaultHttp2Connection(true);
    conn.addListener(new Http2GoAwayListener(pipeline.channel()));

    Http2FrameReader reader = new DefaultHttp2FrameReader(true);
    Http2FrameWriter writer = new DefaultHttp2FrameWriter();

    Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
    Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);

    final Http2ConnectionHandler handler = new Http2ServerConnectionHandler(decoder, encoder,
            new Http2Settings());

    // Setup post build options
    final Http2RequestDecoder listener = new Http2RequestDecoder(pipeline.channel(), handler.encoder());

    handler.connection().addListener(listener);
    handler.decoder().frameListener(listener);
    handler.gracefulShutdownTimeoutMillis(config.idleTimeoutMillis());

    return handler;
}

From source file:com.linecorp.armeria.server.HttpServerPipelineConfigurator.java

License:Apache License

private Http2ConnectionHandler newHttp2ConnectionHandler(ChannelPipeline pipeline) {

    final Http2Connection conn = new DefaultHttp2Connection(true);
    conn.addListener(new Http2GoAwayListener(pipeline.channel()));

    final Http2FrameReader reader = new DefaultHttp2FrameReader(true);
    final Http2FrameWriter writer = new DefaultHttp2FrameWriter();

    final Http2ConnectionEncoder encoder = new DefaultHttp2ConnectionEncoder(conn, writer);
    final Http2ConnectionDecoder decoder = new DefaultHttp2ConnectionDecoder(conn, encoder, reader);

    final Http2ConnectionHandler handler = new Http2ServerConnectionHandler(decoder, encoder,
            new Http2Settings());

    // Setup post build options
    final Http2RequestDecoder listener = new Http2RequestDecoder(config, pipeline.channel(), handler.encoder());

    handler.connection().addListener(listener);
    handler.decoder().frameListener(listener);
    handler.gracefulShutdownTimeoutMillis(config.idleTimeoutMillis());

    return handler;
}