Package io.netty.handler.codec.http2
Class Http2ConnectionHandler.PrefaceDecoder
- java.lang.Object
-
- io.netty.handler.codec.http2.Http2ConnectionHandler.BaseDecoder
-
- io.netty.handler.codec.http2.Http2ConnectionHandler.PrefaceDecoder
-
- Enclosing class:
- Http2ConnectionHandler
private final class Http2ConnectionHandler.PrefaceDecoder extends Http2ConnectionHandler.BaseDecoder
-
-
Field Summary
Fields Modifier and Type Field Description private ByteBufclientPrefaceStringprivate booleanprefaceSent
-
Constructor Summary
Constructors Constructor Description PrefaceDecoder(ChannelHandlerContext ctx)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidchannelActive(ChannelHandlerContext ctx)voidchannelInactive(ChannelHandlerContext ctx)private voidcleanup()Releases theclientPrefaceString.voiddecode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)voidhandlerRemoved(ChannelHandlerContext ctx)Releases theclientPrefaceString.booleanprefaceSent()Determine if the HTTP/2 connection preface been sent.private booleanreadClientPrefaceString(ByteBuf in)Decodes the client connection preface string from the input buffer.private voidsendPreface(ChannelHandlerContext ctx)Sends the HTTP/2 connection preface upon establishment of the connection, if not already sent.private booleanverifyFirstFrameIsSettings(ByteBuf in)Peeks at that the next frame in the buffer and verifies that it is a non-ackSETTINGSframe.
-
-
-
Field Detail
-
clientPrefaceString
private ByteBuf clientPrefaceString
-
prefaceSent
private boolean prefaceSent
-
-
Constructor Detail
-
PrefaceDecoder
PrefaceDecoder(ChannelHandlerContext ctx) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-
Method Detail
-
prefaceSent
public boolean prefaceSent()
Description copied from class:Http2ConnectionHandler.BaseDecoderDetermine if the HTTP/2 connection preface been sent.- Overrides:
prefaceSentin classHttp2ConnectionHandler.BaseDecoder
-
decode
public void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
- Specified by:
decodein classHttp2ConnectionHandler.BaseDecoder- Throws:
java.lang.Exception
-
channelActive
public void channelActive(ChannelHandlerContext ctx) throws java.lang.Exception
- Overrides:
channelActivein classHttp2ConnectionHandler.BaseDecoder- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
- Overrides:
channelInactivein classHttp2ConnectionHandler.BaseDecoder- Throws:
java.lang.Exception
-
handlerRemoved
public void handlerRemoved(ChannelHandlerContext ctx) throws java.lang.Exception
Releases theclientPrefaceString. Any active streams will be left in the open.- Overrides:
handlerRemovedin classHttp2ConnectionHandler.BaseDecoder- Throws:
java.lang.Exception
-
cleanup
private void cleanup()
Releases theclientPrefaceString. Any active streams will be left in the open.
-
readClientPrefaceString
private boolean readClientPrefaceString(ByteBuf in) throws Http2Exception
Decodes the client connection preface string from the input buffer.- Returns:
trueif processing of the client preface string is complete. Since client preface strings can only be received by servers, returns true immediately for client endpoints.- Throws:
Http2Exception
-
verifyFirstFrameIsSettings
private boolean verifyFirstFrameIsSettings(ByteBuf in) throws Http2Exception
Peeks at that the next frame in the buffer and verifies that it is a non-ackSETTINGSframe.- Parameters:
in- the inbound buffer.- Returns:
trueif the next frame is a non-ackSETTINGSframe,falseif more data is required before we can determine the next frame type.- Throws:
Http2Exception- thrown if the next frame is NOT a non-ackSETTINGSframe.
-
sendPreface
private void sendPreface(ChannelHandlerContext ctx) throws java.lang.Exception
Sends the HTTP/2 connection preface upon establishment of the connection, if not already sent.- Throws:
java.lang.Exception
-
-