List of usage examples for io.netty.handler.codec.http2 Http2ServerUpgradeCodec Http2ServerUpgradeCodec
public Http2ServerUpgradeCodec(Http2FrameCodec http2Codec, ChannelHandler... handlers)
From source file:org.wso2.carbon.inbound.endpoint.protocol.http2.InboundHttp2ServerInitializer.java
License:Open Source License
/** * start channel for HTTP/2 Cleartext//www .ja v a 2 s. co m * * @param ch * @param connectionHandler * @param channelHandler */ private void configureClearText(SocketChannel ch, final Http2ConnectionHandler connectionHandler, final InboundHttp2SourceHandler channelHandler) { final ChannelPipeline p = ch.pipeline(); final HttpServerCodec sourceCodec = new HttpServerCodec(); upgradeCodecFactory = new UpgradeCodecFactory() { public UpgradeCodec newUpgradeCodec(CharSequence protocol) { if (AsciiString.contentEquals(Http2CodecUtil.HTTP_UPGRADE_PROTOCOL_NAME, protocol)) { return new Http2ServerUpgradeCodec(null, connectionHandler); } else { return null; } } }; p.addLast(sourceCodec); p.addLast(new HttpServerUpgradeHandler(sourceCodec, upgradeCodecFactory)); p.addLast(channelHandler); p.addLast(new UserEventLogger()); }