- java.lang.Object
-
- io.netty5.handler.codec.http2.DefaultHttp2FrameReader
-
- All Implemented Interfaces:
Http2FrameReader
,Http2FrameReader.Configuration
,Http2FrameSizePolicy
,Closeable
,AutoCloseable
@UnstableApi public class DefaultHttp2FrameReader extends Object implements Http2FrameReader, Http2FrameSizePolicy, Http2FrameReader.Configuration
AHttp2FrameReader
that supports all frame types defined by the HTTP/2 specification.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
DefaultHttp2FrameReader.HeadersBlockBuilder
Utility class to help with construction of the headers block that may potentially span multiple frames.-
Nested classes/interfaces inherited from interface io.netty5.handler.codec.http2.Http2FrameReader
Http2FrameReader.Configuration
-
-
Constructor Summary
Constructors Constructor Description DefaultHttp2FrameReader()
Create a new instance.DefaultHttp2FrameReader(boolean validateHeaders)
Create a new instance.DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes this reader and frees any allocated resources.Http2FrameReader.Configuration
configuration()
Get the configuration related elements for thisHttp2FrameReader
Http2FrameSizePolicy
frameSizePolicy()
Get theHttp2FrameSizePolicy
for thisHttp2FrameReader
Http2HeadersDecoder.Configuration
headersConfiguration()
Get theHttp2HeadersDecoder.Configuration
for thisHttp2FrameReader
int
maxFrameSize()
Gets the maximum allowed frame size.void
maxFrameSize(int max)
Sets the maximum allowed frame size.void
readFrame(ChannelHandlerContext ctx, Buffer input, Http2FrameListener listener)
Attempts to read the next frame from the input buffer.
-
-
-
Constructor Detail
-
DefaultHttp2FrameReader
public DefaultHttp2FrameReader()
Create a new instance.Header names will be validated.
-
DefaultHttp2FrameReader
public DefaultHttp2FrameReader(boolean validateHeaders)
Create a new instance.- Parameters:
validateHeaders
-true
to validate headers.false
to not validate headers.- See Also:
DefaultHttp2HeadersDecoder(boolean)
-
DefaultHttp2FrameReader
public DefaultHttp2FrameReader(Http2HeadersDecoder headersDecoder)
-
-
Method Detail
-
headersConfiguration
public Http2HeadersDecoder.Configuration headersConfiguration()
Description copied from interface:Http2FrameReader.Configuration
Get theHttp2HeadersDecoder.Configuration
for thisHttp2FrameReader
- Specified by:
headersConfiguration
in interfaceHttp2FrameReader.Configuration
-
configuration
public Http2FrameReader.Configuration configuration()
Description copied from interface:Http2FrameReader
Get the configuration related elements for thisHttp2FrameReader
- Specified by:
configuration
in interfaceHttp2FrameReader
-
frameSizePolicy
public Http2FrameSizePolicy frameSizePolicy()
Description copied from interface:Http2FrameReader.Configuration
Get theHttp2FrameSizePolicy
for thisHttp2FrameReader
- Specified by:
frameSizePolicy
in interfaceHttp2FrameReader.Configuration
-
maxFrameSize
public void maxFrameSize(int max) throws Http2Exception
Description copied from interface:Http2FrameSizePolicy
Sets 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
SETTINGS
frame.- Specified by:
maxFrameSize
in interfaceHttp2FrameSizePolicy
- Throws:
Http2Exception
-
maxFrameSize
public int maxFrameSize()
Description copied from interface:Http2FrameSizePolicy
Gets 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_SIZE
can be used as a more conservative default.- Specified by:
maxFrameSize
in interfaceHttp2FrameSizePolicy
-
close
public void close()
Description copied from interface:Http2FrameReader
Closes this reader and frees any allocated resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceHttp2FrameReader
-
readFrame
public void readFrame(ChannelHandlerContext ctx, Buffer input, Http2FrameListener listener) throws Http2Exception
Description copied from interface:Http2FrameReader
Attempts 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:
readFrame
in interfaceHttp2FrameReader
- Throws:
Http2Exception
-
-