Example usage for io.netty.handler.codec.http HttpServerUpgradeHandler HttpServerUpgradeHandler

List of usage examples for io.netty.handler.codec.http HttpServerUpgradeHandler HttpServerUpgradeHandler

Introduction

In this page you can find the example usage for io.netty.handler.codec.http HttpServerUpgradeHandler HttpServerUpgradeHandler.

Prototype

public HttpServerUpgradeHandler(SourceCodec sourceCodec, UpgradeCodecFactory upgradeCodecFactory,
        int maxContentLength) 

Source Link

Document

Constructs the upgrader with the supported codecs.

Usage

From source file:Http2ServerInitializer.java

License:Apache License

/**
 * Configure the pipeline for a cleartext upgrade from HTTP to HTTP/2.
 *//*from   w  w  w.j  a  v a2 s .  co  m*/
private static void configureClearText(SocketChannel ch) {
    HttpServerCodec sourceCodec = new HttpServerCodec();
    HttpServerUpgradeHandler.UpgradeCodec upgradeCodec = new Http2ServerUpgradeCodec(
            new HelloWorldHttp2Handler());
    HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec,
            Collections.singletonList(upgradeCodec), 65536);

    ch.pipeline().addLast(sourceCodec);
    ch.pipeline().addLast(upgradeHandler);
    ch.pipeline().addLast(new UserEventLogger());
}

From source file:netty.mmb.http2.Server.Http2ServerInitializer.java

License:Apache License

/**
 * Configure the pipeline for a cleartext upgrade from HTTP to HTTP/2.
 *//*  w w  w . j a  va 2  s .  c o  m*/
private static void configureClearText(SocketChannel ch) {
    //        HttpServer
    HttpServerCodec sourceCodec = new HttpServerCodec();
    //        HttpServerUpgrade
    HttpServerUpgradeHandler.UpgradeCodec upgradeCodec = new Http2ServerUpgradeCodec(new Http2Handler());
    HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec,
            Collections.singletonList(upgradeCodec), 65536);

    ch.pipeline().addLast(sourceCodec);
    ch.pipeline().addLast(upgradeHandler);
    //        Invoked if the user triggered an event with some custom object
    ch.pipeline().addLast(new UserEventLogger());
}

From source file:org.jboss.aerogear.webpush.netty.WebPushChannelInitializer.java

License:Apache License

private static void configureClearText(final SocketChannel ch, final WebPushServer webPushServer) {
    final HttpServerCodec sourceCodec = new HttpServerCodec();
    final HttpServerUpgradeHandler upgradeHandler = new HttpServerUpgradeHandler(sourceCodec,
            new WebPushCodecFactory(webPushServer), 65536);
    ch.pipeline().addLast(sourceCodec);// w ww.jav a2  s.  co m
    ch.pipeline().addLast(upgradeHandler);
}