Package reactor.netty.http
Class HttpDecoderSpec<T extends HttpDecoderSpec<T>>
java.lang.Object
reactor.netty.http.HttpDecoderSpec<T>
- All Implemented Interfaces:
Supplier<T>
- Direct Known Subclasses:
HttpRequestDecoderSpec
,HttpResponseDecoderSpec
public abstract class HttpDecoderSpec<T extends HttpDecoderSpec<T>>
extends Object
implements Supplier<T>
A configuration builder to fine tune the
HttpCodec
(or more precisely
the settings for the decoder).- Author:
- Violeta Georgieva
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected boolean
static final boolean
static final boolean
static final int
static final int
Deprecated.as of 1.1.0.static final int
static final int
static final boolean
protected int
protected int
protected int
protected int
protected int
protected boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the configuration whether to allow duplicateContent-Length
headers.allowDuplicateContentLengths
(boolean allow) Configure whether to allow duplicateContent-Length
headers.boolean
Return the configuration whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer.allowPartialChunks
(boolean allowPartialChunks) Configure whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer.boolean
int
Return the configured maximum length of the content of the HTTP/2.0 clear-text upgrade request.h2cMaxContentLength
(int h2cMaxContentLength) Configure the maximum length of the content of the HTTP/2.0 clear-text upgrade request.int
hashCode()
int
Return the configured initial buffer size for HTTP request decoding.initialBufferSize
(int value) Configure the initial buffer size for HTTP request decoding.int
Deprecated.as of 1.1.0.maxChunkSize
(int value) Deprecated.as of 1.1.0.int
Return the configured maximum header size that can be decoded for the HTTP request.maxHeaderSize
(int value) Configure the maximum header size that can be decoded for the HTTP request.int
Return the configured maximum length that can be decoded for the HTTP request's initial line.maxInitialLineLength
(int value) Configure the maximum length that can be decoded for the HTTP request's initial line.boolean
Return the configuration whether to validate headers when decoding requests.validateHeaders
(boolean validate) Configure whether to validate headers when decoding requests.
-
Field Details
-
DEFAULT_MAX_INITIAL_LINE_LENGTH
public static final int DEFAULT_MAX_INITIAL_LINE_LENGTH- See Also:
-
DEFAULT_MAX_HEADER_SIZE
public static final int DEFAULT_MAX_HEADER_SIZE- See Also:
-
DEFAULT_MAX_CHUNK_SIZE
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 does not support this configuration.Default max chunk size.- See Also:
-
DEFAULT_VALIDATE_HEADERS
public static final boolean DEFAULT_VALIDATE_HEADERS- See Also:
-
DEFAULT_INITIAL_BUFFER_SIZE
public static final int DEFAULT_INITIAL_BUFFER_SIZE- See Also:
-
DEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS
public static final boolean DEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS- See Also:
-
DEFAULT_ALLOW_PARTIAL_CHUNKS
public static final boolean DEFAULT_ALLOW_PARTIAL_CHUNKS- See Also:
-
maxInitialLineLength
protected int maxInitialLineLength -
maxHeaderSize
protected int maxHeaderSize -
maxChunkSize
protected int maxChunkSize -
validateHeaders
protected boolean validateHeaders -
initialBufferSize
protected int initialBufferSize -
allowDuplicateContentLengths
protected boolean allowDuplicateContentLengths -
h2cMaxContentLength
protected int h2cMaxContentLength -
allowPartialChunks
protected boolean allowPartialChunks
-
-
Constructor Details
-
HttpDecoderSpec
public HttpDecoderSpec()
-
-
Method Details
-
maxInitialLineLength
Configure the maximum length that can be decoded for the HTTP request's initial line. Defaults toDEFAULT_MAX_INITIAL_LINE_LENGTH
.- Parameters:
value
- the value for the maximum initial line length (strictly positive)- Returns:
- this option builder for further configuration
-
maxInitialLineLength
public int maxInitialLineLength()Return the configured maximum length that can be decoded for the HTTP request's initial line.- Returns:
- the configured maximum length that can be decoded for the HTTP request's initial line
-
maxHeaderSize
Configure the maximum header size that can be decoded for the HTTP request. Defaults toDEFAULT_MAX_HEADER_SIZE
.- Parameters:
value
- the value for the maximum header size (strictly positive)- Returns:
- this option builder for further configuration
-
maxHeaderSize
public int maxHeaderSize()Return the configured maximum header size that can be decoded for the HTTP request.- Returns:
- the configured maximum header size that can be decoded for the HTTP request
-
maxChunkSize
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 does not support this configuration.Configure the maximum chunk size that can be decoded for the HTTP request. Defaults toDEFAULT_MAX_CHUNK_SIZE
.- Parameters:
value
- the value for the maximum chunk size (strictly positive)- Returns:
- this option builder for further configuration
-
maxChunkSize
Deprecated.as of 1.1.0. This will be removed in 2.0.0 as Netty 5 does not support this configuration.Return the configured maximum chunk size that can be decoded for the HTTP request.- Returns:
- the configured maximum chunk size that can be decoded for the HTTP request
-
validateHeaders
Configure whether to validate headers when decoding requests. Defaults toDEFAULT_VALIDATE_HEADERS
.- Parameters:
validate
- true to validate headers, false otherwise- Returns:
- this option builder for further configuration
-
validateHeaders
public boolean validateHeaders()Return the configuration whether to validate headers when decoding requests.- Returns:
- the configuration whether to validate headers when decoding requests
-
initialBufferSize
Configure the initial buffer size for HTTP request decoding. Defaults toDEFAULT_INITIAL_BUFFER_SIZE
.- Parameters:
value
- the initial buffer size to use (strictly positive)- Returns:
- this option builder for further configuration
-
initialBufferSize
public int initialBufferSize()Return the configured initial buffer size for HTTP request decoding.- Returns:
- the configured initial buffer size for HTTP request decoding
-
allowDuplicateContentLengths
Configure whether to allow duplicateContent-Length
headers. Defaults toDEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS
which means that a message with duplicateContent-Length
headers is rejected. When this is configured totrue
, duplicateContent-Length
headers are accepted only if they are all the same value, otherwise such message is rejected. The duplicatedContent-Length
headers are replaced with a single validContent-Length
header.- Parameters:
allow
- true to allow duplicateContent-Length
headers with the same value, false otherwise- Returns:
- this option builder for further configuration
- Since:
- 1.0.8
-
allowDuplicateContentLengths
public boolean allowDuplicateContentLengths()Return the configuration whether to allow duplicateContent-Length
headers.- Returns:
- the configuration whether to allow duplicate
Content-Length
headers - Since:
- 1.0.8
-
h2cMaxContentLength
Configure the maximum length of the content of the HTTP/2.0 clear-text upgrade request.- By default the server will reject an upgrade request with non-empty content,
because the upgrade request is most likely a GET request. If the client sends
a non-GET upgrade request,
h2cMaxContentLength
specifies the maximum length of the content of the upgrade request. - By default the client will allow an upgrade request with up to 65536 as the maximum length of the aggregated content.
- Parameters:
h2cMaxContentLength
- the maximum length of the content of the upgrade request- Returns:
- this builder for further configuration
- By default the server will reject an upgrade request with non-empty content,
because the upgrade request is most likely a GET request. If the client sends
a non-GET upgrade request,
-
h2cMaxContentLength
public int h2cMaxContentLength()Return the configured maximum length of the content of the HTTP/2.0 clear-text upgrade request.- Returns:
- the configured maximum length of the content of the HTTP/2.0 clear-text upgrade request
-
allowPartialChunks
Configure whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer. Defaults toDEFAULT_ALLOW_PARTIAL_CHUNKS
.- Parameters:
allowPartialChunks
- set tofalse
to only allow sending whole chunks down the pipeline.- Returns:
- this option builder for further configuration
- Since:
- 1.1.23
-
allowPartialChunks
public boolean allowPartialChunks()Return the configuration whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer.- Returns:
- whether to only allow sending whole chunks down the pipeline.
- Since:
- 1.1.23
-
equals
-
hashCode
public int hashCode()
-