View Javadoc
1   /*
2    * Copyright 2014 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License, version 2.0 (the
5    * "License"); you may not use this file except in compliance with the License. You may obtain a
6    * 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 distributed under the License
11   * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12   * or implied. See the License for the specific language governing permissions and limitations under
13   * the License.
14   */
15  package io.netty.handler.codec.http2;
16  
17  import io.netty.buffer.ByteBuf;
18  import io.netty.channel.ChannelHandlerContext;
19  
20  /**
21   * This class brings {@link Http2Connection.Listener} and {@link Http2FrameListener} together to provide
22   * NOOP implementation so inheriting classes can selectively choose which methods to override.
23   */
24  public class Http2EventAdapter implements Http2Connection.Listener, Http2FrameListener {
25      @Override
26      public int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream)
27              throws Http2Exception {
28          return data.readableBytes() + padding;
29      }
30  
31      @Override
32      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding,
33              boolean endStream) throws Http2Exception {
34      }
35  
36      @Override
37      public void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency,
38              short weight, boolean exclusive, int padding, boolean endStream) throws Http2Exception {
39      }
40  
41      @Override
42      public void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight,
43              boolean exclusive) throws Http2Exception {
44      }
45  
46      @Override
47      public void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode) throws Http2Exception {
48      }
49  
50      @Override
51      public void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception {
52      }
53  
54      @Override
55      public void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception {
56      }
57  
58      @Override
59      public void onPingRead(ChannelHandlerContext ctx, long data) throws Http2Exception {
60      }
61  
62      @Override
63      public void onPingAckRead(ChannelHandlerContext ctx, long data) throws Http2Exception {
64      }
65  
66      @Override
67      public void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId,
68              Http2Headers headers, int padding) throws Http2Exception {
69      }
70  
71      @Override
72      public void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData)
73              throws Http2Exception {
74      }
75  
76      @Override
77      public void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement)
78              throws Http2Exception {
79      }
80  
81      @Override
82      public void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags,
83              ByteBuf payload) throws Http2Exception {
84      }
85  
86      @Override
87      public void onStreamAdded(Http2Stream stream) {
88      }
89  
90      @Override
91      public void onStreamActive(Http2Stream stream) {
92      }
93  
94      @Override
95      public void onStreamHalfClosed(Http2Stream stream) {
96      }
97  
98      @Override
99      public void onStreamClosed(Http2Stream stream) {
100     }
101 
102     @Override
103     public void onStreamRemoved(Http2Stream stream) {
104     }
105 
106     @Override
107     public void onGoAwaySent(int lastStreamId, long errorCode, ByteBuf debugData) {
108     }
109 
110     @Override
111     public void onGoAwayReceived(int lastStreamId, long errorCode, ByteBuf debugData) {
112     }
113 }