List of usage examples for io.netty.handler.codec.http2 Http2FrameCodecBuilder forServer
public static Http2FrameCodecBuilder forServer()
From source file:example.http2.helloworld.frame.server.Http2OrHttpHandler.java
License:Apache License
@Override protected void configurePipeline(ChannelHandlerContext ctx, String protocol) throws Exception { if (ApplicationProtocolNames.HTTP_2.equals(protocol)) { ctx.pipeline().addLast(Http2FrameCodecBuilder.forServer().build(), new HelloWorldHttp2Handler()); return;/*www.j a v a 2s . c o m*/ } if (ApplicationProtocolNames.HTTP_1_1.equals(protocol)) { ctx.pipeline().addLast(new HttpServerCodec(), new HttpObjectAggregator(MAX_CONTENT_LENGTH), new HelloWorldHttp1Handler("ALPN Negotiation")); return; } throw new IllegalStateException("unknown protocol: " + protocol); }
From source file:io.netty.example.http2.helloworld.multiplex.server.Http2OrHttpHandler.java
License:Apache License
@Override protected void configurePipeline(ChannelHandlerContext ctx, String protocol) throws Exception { if (ApplicationProtocolNames.HTTP_2.equals(protocol)) { ctx.pipeline().addLast(Http2FrameCodecBuilder.forServer().build()); ctx.pipeline().addLast(new Http2MultiplexHandler(new HelloWorldHttp2Handler())); return;// w w w . ja v a2 s. co m } if (ApplicationProtocolNames.HTTP_1_1.equals(protocol)) { ctx.pipeline().addLast(new HttpServerCodec(), new HttpObjectAggregator(MAX_CONTENT_LENGTH), new HelloWorldHttp1Handler("ALPN Negotiation")); return; } throw new IllegalStateException("unknown protocol: " + protocol); }