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 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 public static final int 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

      public T maxInitialLineLength(int value)
      Configure the maximum length that can be decoded for the HTTP request's initial line. Defaults to DEFAULT_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

      public T maxHeaderSize(int value)
      Configure the maximum header size that can be decoded for the HTTP request. Defaults to DEFAULT_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 public T maxChunkSize(int value)
      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 to DEFAULT_MAX_CHUNK_SIZE.
      Parameters:
      value - the value for the maximum chunk size (strictly positive)
      Returns:
      this option builder for further configuration
    • maxChunkSize

      @Deprecated public int 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

      public T validateHeaders(boolean validate)
      Configure whether to validate headers when decoding requests. Defaults to DEFAULT_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

      public T initialBufferSize(int value)
      Configure the initial buffer size for HTTP request decoding. Defaults to DEFAULT_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

      public T allowDuplicateContentLengths(boolean allow)
      Configure whether to allow duplicate Content-Length headers. Defaults to DEFAULT_ALLOW_DUPLICATE_CONTENT_LENGTHS which means that a message with duplicate Content-Length headers is rejected. When this is configured to true, duplicate Content-Length headers are accepted only if they are all the same value, otherwise such message is rejected. The duplicated Content-Length headers are replaced with a single valid Content-Length header.
      Parameters:
      allow - true to allow duplicate Content-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 duplicate Content-Length headers.
      Returns:
      the configuration whether to allow duplicate Content-Length headers
      Since:
      1.0.8
    • h2cMaxContentLength

      public T h2cMaxContentLength(int 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
    • 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

      public T allowPartialChunks(boolean allowPartialChunks)
      Configure whether chunks can be split into multiple messages, if their chunk size exceeds the size of the input buffer. Defaults to DEFAULT_ALLOW_PARTIAL_CHUNKS.
      Parameters:
      allowPartialChunks - set to false 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object