Class DefaultHttp2FrameReader
java.lang.Object
io.netty.handler.codec.http2.DefaultHttp2FrameReader
- All Implemented Interfaces:
Http2FrameReader, Http2FrameReader.Configuration, Http2FrameSizePolicy, Closeable, AutoCloseable
public class DefaultHttp2FrameReader
extends Object
implements Http2FrameReader, Http2FrameSizePolicy, Http2FrameReader.Configuration
A
Http2FrameReader that supports all frame types defined by the HTTP/2 specification.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classUtility class to help with construction of the headers block that may potentially span multiple frames.Nested classes/interfaces inherited from interface Http2FrameReader
Http2FrameReader.Configuration -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance.DefaultHttp2FrameReader(boolean validateHeaders) Create a new instance.DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this reader and frees any allocated resources.Get the configuration related elements for thisHttp2FrameReaderGet theHttp2FrameSizePolicyfor thisHttp2FrameReaderGet theHttp2HeadersDecoder.Configurationfor thisHttp2FrameReaderintGets the maximum allowed frame size.voidmaxFrameSize(int max) Sets the maximum allowed frame size.voidreadFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) Attempts to read the next frame from the input buffer.
-
Constructor Details
-
DefaultHttp2FrameReader
public DefaultHttp2FrameReader()Create a new instance.Header names will be validated.
-
DefaultHttp2FrameReader
public DefaultHttp2FrameReader(boolean validateHeaders) Create a new instance.- Parameters:
validateHeaders-trueto validate headers.falseto not validate headers.- See Also:
-
DefaultHttp2FrameReader
-
-
Method Details
-
headersConfiguration
Description copied from interface:Http2FrameReader.ConfigurationGet theHttp2HeadersDecoder.Configurationfor thisHttp2FrameReader- Specified by:
headersConfigurationin interfaceHttp2FrameReader.Configuration
-
configuration
Description copied from interface:Http2FrameReaderGet the configuration related elements for thisHttp2FrameReader- Specified by:
configurationin interfaceHttp2FrameReader
-
frameSizePolicy
Description copied from interface:Http2FrameReader.ConfigurationGet theHttp2FrameSizePolicyfor thisHttp2FrameReader- Specified by:
frameSizePolicyin interfaceHttp2FrameReader.Configuration
-
maxFrameSize
Description copied from interface:Http2FrameSizePolicySets the maximum allowed frame size. Attempts to write frames longer than this maximum will fail.This value is used to represent SETTINGS_MAX_FRAME_SIZE. This method should only be called by Netty (not users) as a result of a receiving a
SETTINGSframe.- Specified by:
maxFrameSizein interfaceHttp2FrameSizePolicy- Throws:
Http2Exception
-
maxFrameSize
public int maxFrameSize()Description copied from interface:Http2FrameSizePolicyGets the maximum allowed frame size.This value is used to represent SETTINGS_MAX_FRAME_SIZE. The initial value defined by the RFC is unlimited but enforcing a lower limit is generally permitted.
Http2CodecUtil.DEFAULT_MAX_FRAME_SIZEcan be used as a more conservative default.- Specified by:
maxFrameSizein interfaceHttp2FrameSizePolicy
-
close
public void close()Description copied from interface:Http2FrameReaderCloses this reader and frees any allocated resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceHttp2FrameReader
-
readFrame
public void readFrame(ChannelHandlerContext ctx, ByteBuf input, Http2FrameListener listener) throws Http2Exception Description copied from interface:Http2FrameReaderAttempts to read the next frame from the input buffer. If enough data is available to fully read the frame, notifies the listener of the read frame.- Specified by:
readFramein interfaceHttp2FrameReader- Throws:
Http2Exception
-