public class HttpRequestDecoder extends HttpObjectDecoder
ByteBufs into HttpRequests and HttpContents.
| Name | Meaning |
|---|---|
maxInitialLineLength |
The maximum length of the initial line (e.g. "GET / HTTP/1.0")
If the length of the initial line exceeds this value, a
TooLongHttpLineException will be raised. |
maxHeaderSize |
The maximum length of all headers. If the sum of the length of each
header exceeds this value, a TooLongHttpHeaderException will be raised. |
maxChunkSize |
The maximum length of the content or each chunk. If the content length
exceeds this value, the transfer encoding of the decoded request will be
converted to 'chunked' and the content will be split into multiple
HttpContents. If the transfer encoding of the HTTP request is
'chunked' already, each chunk will be split into smaller chunks if the
length of the chunk exceeds this value. If you prefer not to handle
HttpContents in your handler, insert HttpObjectAggregator
after this decoder in the ChannelPipeline. |
| Name | Default value | Meaning |
|---|---|---|
allowDuplicateContentLengths |
When set to false, will reject any messages that contain multiple Content-Length header fields.
When set to true, will allow multiple Content-Length headers only if they are all the same decimal value.
The duplicated field-values will be replaced with a single valid Content-Length field.
See RFC 7230, Section 3.3.2. |
|
allowPartialChunks |
If the length of a chunk exceeds the ByteBufs readable bytes and allowPartialChunks
is set to true, the chunk will be split into multiple HttpContents.
Otherwise, if the chunk size does not exceed maxChunkSize and allowPartialChunks
is set to false, the ByteBuf is not decoded into an HttpContent until
the readable bytes are greater or equal to the chunk size. |
DEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS, DEFAULT_ALLOW_PARTIAL_CHUNKS, DEFAULT_CHUNKED_SUPPORTED, DEFAULT_INITIAL_BUFFER_SIZE, DEFAULT_MAX_CHUNK_SIZE, DEFAULT_MAX_HEADER_SIZE, DEFAULT_MAX_INITIAL_LINE_LENGTH, DEFAULT_VALIDATE_HEADERS, validateHeaders| Constructor and Description |
|---|
HttpRequestDecoder()
Creates a new instance with the default
maxInitialLineLength (4096), maxHeaderSize (8192), and
maxChunkSize (8192). |
HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize)
Creates a new instance with the specified parameters.
|
HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders) |
HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize) |
HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths) |
HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths,
boolean allowPartialChunks) |
| Modifier and Type | Method and Description |
|---|---|
protected HttpMessage |
createInvalidMessage() |
protected HttpMessage |
createMessage(String[] initialLine) |
protected boolean |
isContentAlwaysEmpty(HttpMessage msg) |
protected boolean |
isDecodingRequest() |
protected String |
splitFirstWordInitialLine(byte[] sb,
int start,
int length) |
protected io.netty.util.AsciiString |
splitHeaderName(byte[] sb,
int start,
int length) |
protected String |
splitThirdWordInitialLine(byte[] sb,
int start,
int length) |
decode, decodeLast, handlerRemoved0, handleTransferEncodingChunkedWithContentLength, isSwitchingToNonHttp1Protocol, reset, splitSecondWordInitialLine, userEventTriggeredactualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecodechannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharablepublic HttpRequestDecoder()
maxInitialLineLength (4096), maxHeaderSize (8192), and
maxChunkSize (8192).public HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize)
public HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders)
public HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize)
public HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths)
public HttpRequestDecoder(int maxInitialLineLength,
int maxHeaderSize,
int maxChunkSize,
boolean validateHeaders,
int initialBufferSize,
boolean allowDuplicateContentLengths,
boolean allowPartialChunks)
protected HttpMessage createMessage(String[] initialLine) throws Exception
createMessage in class HttpObjectDecoderExceptionprotected io.netty.util.AsciiString splitHeaderName(byte[] sb,
int start,
int length)
splitHeaderName in class HttpObjectDecoderprotected String splitFirstWordInitialLine(byte[] sb, int start, int length)
splitFirstWordInitialLine in class HttpObjectDecoderprotected String splitThirdWordInitialLine(byte[] sb, int start, int length)
splitThirdWordInitialLine in class HttpObjectDecoderprotected HttpMessage createInvalidMessage()
createInvalidMessage in class HttpObjectDecoderprotected boolean isDecodingRequest()
isDecodingRequest in class HttpObjectDecoderprotected boolean isContentAlwaysEmpty(HttpMessage msg)
isContentAlwaysEmpty in class HttpObjectDecoderCopyright © 2008–2023 The Netty Project. All rights reserved.