View Javadoc
1   /*
2    * Copyright 2015 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   https://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package io.netty.handler.codec.http2;
18  
19  import io.netty.handler.codec.http.HttpScheme;
20  import io.netty.handler.codec.http2.Http2HeadersEncoder.SensitivityDetector;
21  
22  /**
23   * Builder which builds {@link HttpToHttp2ConnectionHandler} objects.
24   */
25  public final class HttpToHttp2ConnectionHandlerBuilder extends
26          AbstractHttp2ConnectionHandlerBuilder<HttpToHttp2ConnectionHandler, HttpToHttp2ConnectionHandlerBuilder> {
27  
28      private HttpScheme httpScheme;
29  
30      @Override
31      public HttpToHttp2ConnectionHandlerBuilder validateHeaders(boolean validateHeaders) {
32          return super.validateHeaders(validateHeaders);
33      }
34  
35      @Override
36      public HttpToHttp2ConnectionHandlerBuilder initialSettings(Http2Settings settings) {
37          return super.initialSettings(settings);
38      }
39  
40      @Override
41      public HttpToHttp2ConnectionHandlerBuilder frameListener(Http2FrameListener frameListener) {
42          return super.frameListener(frameListener);
43      }
44  
45      @Override
46      public HttpToHttp2ConnectionHandlerBuilder gracefulShutdownTimeoutMillis(long gracefulShutdownTimeoutMillis) {
47          return super.gracefulShutdownTimeoutMillis(gracefulShutdownTimeoutMillis);
48      }
49  
50      @Override
51      public HttpToHttp2ConnectionHandlerBuilder server(boolean isServer) {
52          return super.server(isServer);
53      }
54  
55      @Override
56      public HttpToHttp2ConnectionHandlerBuilder connection(Http2Connection connection) {
57          return super.connection(connection);
58      }
59  
60      @Override
61      public HttpToHttp2ConnectionHandlerBuilder codec(Http2ConnectionDecoder decoder,
62                                                       Http2ConnectionEncoder encoder) {
63          return super.codec(decoder, encoder);
64      }
65  
66      @Override
67      public HttpToHttp2ConnectionHandlerBuilder frameLogger(Http2FrameLogger frameLogger) {
68          return super.frameLogger(frameLogger);
69      }
70  
71      @Override
72      public HttpToHttp2ConnectionHandlerBuilder encoderEnforceMaxConcurrentStreams(
73              boolean encoderEnforceMaxConcurrentStreams) {
74          return super.encoderEnforceMaxConcurrentStreams(encoderEnforceMaxConcurrentStreams);
75      }
76  
77      @Override
78      public HttpToHttp2ConnectionHandlerBuilder headerSensitivityDetector(
79              SensitivityDetector headerSensitivityDetector) {
80          return super.headerSensitivityDetector(headerSensitivityDetector);
81      }
82  
83      @Override
84      public HttpToHttp2ConnectionHandlerBuilder encoderIgnoreMaxHeaderListSize(
85              boolean encoderIgnoreMaxHeaderListSize) {
86          return super.encoderIgnoreMaxHeaderListSize(encoderIgnoreMaxHeaderListSize);
87      }
88  
89      @Override
90      @Deprecated
91      public HttpToHttp2ConnectionHandlerBuilder initialHuffmanDecodeCapacity(int initialHuffmanDecodeCapacity) {
92          return super.initialHuffmanDecodeCapacity(initialHuffmanDecodeCapacity);
93      }
94  
95      @Override
96      public HttpToHttp2ConnectionHandlerBuilder decoupleCloseAndGoAway(boolean decoupleCloseAndGoAway) {
97          return super.decoupleCloseAndGoAway(decoupleCloseAndGoAway);
98      }
99  
100     @Override
101     public HttpToHttp2ConnectionHandlerBuilder flushPreface(boolean flushPreface) {
102         return super.flushPreface(flushPreface);
103     }
104 
105     /**
106      * Add {@code scheme} in {@link Http2Headers} if not already present.
107      *
108      * @param httpScheme {@link HttpScheme} type
109      * @return {@code this}.
110      */
111     public HttpToHttp2ConnectionHandlerBuilder httpScheme(HttpScheme httpScheme) {
112         this.httpScheme = httpScheme;
113         return self();
114     }
115 
116     @Override
117     public HttpToHttp2ConnectionHandler build() {
118         return super.build();
119     }
120 
121     @Override
122     protected HttpToHttp2ConnectionHandler build(Http2ConnectionDecoder decoder, Http2ConnectionEncoder encoder,
123                                                  Http2Settings initialSettings) {
124         return new HttpToHttp2ConnectionHandler(decoder, encoder, initialSettings, isValidateHeaders(),
125                 decoupleCloseAndGoAway(), flushPreface(), httpScheme);
126     }
127 }