Package com.linkedin.alpini.netty4.misc
Class BasicHttpObjectDecoder
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.codec.http.HttpObjectDecoder
-
- com.linkedin.alpini.netty4.misc.BasicHttpObjectDecoder
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
- Direct Known Subclasses:
HttpContentMultiPartDecode
public abstract class BasicHttpObjectDecoder extends io.netty.handler.codec.http.HttpObjectDecoder
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classBasicHttpObjectDecoder.StateThe internal state ofBasicHttpObjectDecoder.
-
Field Summary
Fields Modifier and Type Field Description protected booleanvalidateHeaders
-
Constructor Summary
Constructors Modifier Constructor Description protectedBasicHttpObjectDecoder()Creates a new instance with the defaultmaxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (8192).protectedBasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported)Creates a new instance with the specified parameters.protectedBasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported, boolean validateHeaders)Creates a new instance with the specified parameters.protectedBasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported, boolean validateHeaders, int initialBufferSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract io.netty.handler.codec.http.HttpMessagecreateInvalidMessage()protected io.netty.handler.codec.http.HttpMessagecreateMessage(ByteBufAsciiString[] initialLine)protected abstract io.netty.handler.codec.http.HttpMessagecreateMessage(java.lang.String[] initialLine)protected voiddecode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer, java.util.List<java.lang.Object> out)protected voiddecodeLast(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, java.util.List<java.lang.Object> out)BasicHttpObjectDecoder.StategetDecoderState()protected booleanisContentAlwaysEmpty(io.netty.handler.codec.http.HttpMessage msg)protected abstract booleanisDecodingRequest()protected booleanisSwitchingToNonHttp1Protocol(io.netty.handler.codec.http.HttpResponse msg)Returns true if the server switched to a different protocol than HTTP/1.0 or HTTP/1.1, e.g.voidreset()Resets the state of the decoder so that it is ready to decode a new message.voiduserEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt)-
Methods inherited from class io.netty.handler.codec.http.HttpObjectDecoder
handleTransferEncodingChunkedWithContentLength
-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaught
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, isSharable
-
-
-
-
Constructor Detail
-
BasicHttpObjectDecoder
protected BasicHttpObjectDecoder()
Creates a new instance with the defaultmaxInitialLineLength (4096},maxHeaderSize (8192), andmaxChunkSize (8192).
-
BasicHttpObjectDecoder
protected BasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported)Creates a new instance with the specified parameters.
-
BasicHttpObjectDecoder
protected BasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported, boolean validateHeaders)Creates a new instance with the specified parameters.
-
BasicHttpObjectDecoder
protected BasicHttpObjectDecoder(int maxInitialLineLength, int maxHeaderSize, int maxChunkSize, boolean chunkedSupported, boolean validateHeaders, int initialBufferSize)
-
-
Method Detail
-
getDecoderState
public final BasicHttpObjectDecoder.State getDecoderState()
-
decode
protected void decode(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf buffer, java.util.List<java.lang.Object> out) throws java.lang.Exception- Overrides:
decodein classio.netty.handler.codec.http.HttpObjectDecoder- Throws:
java.lang.Exception
-
decodeLast
protected void decodeLast(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception- Overrides:
decodeLastin classio.netty.handler.codec.http.HttpObjectDecoder- Throws:
java.lang.Exception
-
userEventTriggered
public void userEventTriggered(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object evt) throws java.lang.Exception- Specified by:
userEventTriggeredin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
userEventTriggeredin classio.netty.handler.codec.http.HttpObjectDecoder- Throws:
java.lang.Exception
-
isContentAlwaysEmpty
protected boolean isContentAlwaysEmpty(io.netty.handler.codec.http.HttpMessage msg)
- Overrides:
isContentAlwaysEmptyin classio.netty.handler.codec.http.HttpObjectDecoder
-
isSwitchingToNonHttp1Protocol
protected boolean isSwitchingToNonHttp1Protocol(io.netty.handler.codec.http.HttpResponse msg)
Returns true if the server switched to a different protocol than HTTP/1.0 or HTTP/1.1, e.g. HTTP/2 or Websocket. Returns false if the upgrade happened in a different layer, e.g. upgrade from HTTP/1.1 to HTTP/1.1 over TLS.- Overrides:
isSwitchingToNonHttp1Protocolin classio.netty.handler.codec.http.HttpObjectDecoder
-
reset
public void reset()
Resets the state of the decoder so that it is ready to decode a new message. This method is useful for handling a rejected request withExpect: 100-continueheader.- Overrides:
resetin classio.netty.handler.codec.http.HttpObjectDecoder
-
isDecodingRequest
protected abstract boolean isDecodingRequest()
- Specified by:
isDecodingRequestin classio.netty.handler.codec.http.HttpObjectDecoder
-
createMessage
protected io.netty.handler.codec.http.HttpMessage createMessage(ByteBufAsciiString[] initialLine) throws java.lang.Exception
- Throws:
java.lang.Exception
-
createMessage
protected abstract io.netty.handler.codec.http.HttpMessage createMessage(java.lang.String[] initialLine) throws java.lang.Exception- Specified by:
createMessagein classio.netty.handler.codec.http.HttpObjectDecoder- Throws:
java.lang.Exception
-
createInvalidMessage
protected abstract io.netty.handler.codec.http.HttpMessage createInvalidMessage()
- Specified by:
createInvalidMessagein classio.netty.handler.codec.http.HttpObjectDecoder
-
-