1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package io.netty.example.http2.helloworld.server;
18
19 import io.netty.handler.codec.http2.AbstractHttp2ConnectionHandlerBuilder;
20 import io.netty.handler.codec.http2.Http2ConnectionDecoder;
21 import io.netty.handler.codec.http2.Http2ConnectionEncoder;
22 import io.netty.handler.codec.http2.Http2FrameLogger;
23 import io.netty.handler.codec.http2.Http2Settings;
24
25 import static io.netty.handler.logging.LogLevel.INFO;
26
27 public final class HelloWorldHttp2HandlerBuilder
28 extends AbstractHttp2ConnectionHandlerBuilder<HelloWorldHttp2Handler, HelloWorldHttp2HandlerBuilder> {
29
30 private static final Http2FrameLogger logger = new Http2FrameLogger(INFO, HelloWorldHttp2Handler.class);
31
32 public HelloWorldHttp2HandlerBuilder() {
33 frameLogger(logger);
34 }
35
36 @Override
37 public HelloWorldHttp2Handler build() {
38 return super.build();
39 }
40
41 @Override
42 protected HelloWorldHttp2Handler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
43 Http2Settings initialSettings) {
44 HelloWorldHttp2Handler handler = new HelloWorldHttp2Handler(decoder, encoder, initialSettings);
45 frameListener(handler);
46 return handler;
47 }
48 }