Class HttpServerConfig

java.lang.Object
io.vertx.core.http.HttpServerConfig

@Unstable public class HttpServerConfig extends Object
Configuration of a HttpServer
Author:
Julien Viet
  • Field Details

    • DEFAULT_HTTP3_PORT

      public static final int DEFAULT_HTTP3_PORT
      Default port the server will listen on = 443
      See Also:
    • DEFAULT_VERSIONS

      public static final Set<HttpVersion> DEFAULT_VERSIONS
    • DEFAULT_QUIC_INITIAL_MAX_DATA

      public static final long DEFAULT_QUIC_INITIAL_MAX_DATA
      See Also:
    • DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_LOCAL

      public static final long DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_LOCAL
      See Also:
    • DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_REMOTE

      public static final long DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_BIDI_REMOTE
      See Also:
    • DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_UNI

      public static final long DEFAULT_QUIC_INITIAL_MAX_STREAM_DATA_UNI
      See Also:
    • DEFAULT_QUIC_INITIAL_MAX_STREAM_BIDI

      public static final long DEFAULT_QUIC_INITIAL_MAX_STREAM_BIDI
      See Also:
    • DEFAULT_QUIC_INITIAL_MAX_STREAM_UNI

      public static final long DEFAULT_QUIC_INITIAL_MAX_STREAM_UNI
      See Also:
  • Constructor Details

    • HttpServerConfig

      public HttpServerConfig(HttpServerOptions options)
      Copies the HttpServerOptions.
      Parameters:
      options - the options to copy
    • HttpServerConfig

      public HttpServerConfig()
      Create a default configuration of a server accepting HTTP/1.1 and HTTP/2 protocols.
    • HttpServerConfig

      public HttpServerConfig(HttpServerConfig other)
      Copy constructor
      Parameters:
      other - the config to be copied
  • Method Details

    • setIdleTimeout

      public HttpServerConfig setIdleTimeout(Duration idleTimeout)
      Set the idle timeout, zero or null means don't time out. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout.

      This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.

      Parameters:
      idleTimeout - the timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setReadIdleTimeout

      public HttpServerConfig setReadIdleTimeout(Duration idleTimeout)

      Set the read idle timeout, zero or null means or null means don't time out. This determines if a connection will timeout and be closed if no data is received within the timeout.

      This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.

      Parameters:
      idleTimeout - the read timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setWriteIdleTimeout

      public HttpServerConfig setWriteIdleTimeout(Duration idleTimeout)

      Set the write idle timeout, zero or null means don't time out. This determines if a connection will timeout and be closed if no data is sent within the timeout.

      This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.

      Parameters:
      idleTimeout - the write timeout
      Returns:
      a reference to this, so the API can be used fluently
    • setLogConfig

      public HttpServerConfig setLogConfig(LogConfig config)

      Configure the per stream networking logging: Netty's stream pipeline is configured for logging on Netty's logger.

      This configures both TCP and QUIC nested configurations, you can configure each of them separately if you need to.

      Parameters:
      config - the stream network logging config, null means disabled
      Returns:
      a reference to this, so the API can be used fluently
    • getVersions

      public Set<HttpVersion> getVersions()
      Returns:
      the HTTP versions
    • setVersions

      public HttpServerConfig setVersions(Set<HttpVersion> versions)
      Set the HTTP versions.
      Parameters:
      versions - the versions
      Returns:
      a reference to this, so the API can be used fluently
    • setVersions

      public HttpServerConfig setVersions(HttpVersion... versions)
      Set the HTTP versions.
      Parameters:
      versions - the versions
      Returns:
      a reference to this, so the API can be used fluently
    • setPort

      public HttpServerConfig setPort(int port)
      Set the port used to bind the server at, affecting both TCP and QUIC transports.
      Parameters:
      port - the port
      Returns:
      a reference to this, so the API can be used fluently
    • setHost

      public HttpServerConfig setHost(String host)
      Set the host used to bind the server at, affecting both TCP and QUIC transports.
      Parameters:
      host - the host
      Returns:
      a reference to this, so the API can be used fluently
    • getTcpPort

      public int getTcpPort()
      Returns:
      the port to bind the TCP server at
    • setTcpPort

      public HttpServerConfig setTcpPort(int port)
      Set the port used to bind the TCP server.
      Parameters:
      port - the port
      Returns:
      a reference to this, so the API can be used fluently
    • getTcpHost

      public String getTcpHost()
      Returns:
      the host
    • setTcpHost

      public HttpServerConfig setTcpHost(String host)
      Set the host
      Parameters:
      host - the host
      Returns:
      a reference to this, so the API can be used fluently
    • getQuicPort

      public int getQuicPort()
      Returns:
      the port to bind the QUIC server at
    • setQuicPort

      public HttpServerConfig setQuicPort(int port)
      Set the port used to bind the QUIC server.
      Parameters:
      port - the port
      Returns:
      a reference to this, so the API can be used fluently
    • getQuicHost

      public String getQuicHost()
      Returns:
      the host
    • setQuicHost

      public HttpServerConfig setQuicHost(String host)
      Set the host
      Parameters:
      host - the host
      Returns:
      a reference to this, so the API can be used fluently
    • getFormDecoderConfig

      public FormDecoderConfig getFormDecoderConfig()
    • setFormDecoderConfig

      public HttpServerConfig setFormDecoderConfig(FormDecoderConfig formDecoderConfig)
    • getQueryParamConfig

      public QueryParamDecoderConfig getQueryParamConfig()
      Returns:
      the configuration for parsing HTTP request query parameters, when the configuration is null, the default configuration is used:
      See Also:
    • setQueryParamConfig

      public HttpServerConfig setQueryParamConfig(QueryParamDecoderConfig queryParamDecoderConfig)
      Set the configuration for parsing HTTP request query parameters.
      Parameters:
      queryParamDecoderConfig - the configuration
      Returns:
      a reference to this, so the API can be used fluently
    • isHandle100ContinueAutomatically

      public boolean isHandle100ContinueAutomatically()
      Returns:
      whether 100 Continue should be handled automatically
    • setHandle100ContinueAutomatically

      public HttpServerConfig setHandle100ContinueAutomatically(boolean handle100ContinueAutomatically)
      Set whether 100 Continue should be handled automatically
      Parameters:
      handle100ContinueAutomatically - true if it should be handled automatically
      Returns:
      a reference to this, so the API can be used fluently
    • getStrictThreadMode

      public boolean getStrictThreadMode()
      Returns:
      whether to use the strict thread mode.
    • setStrictThreadMode

      public HttpServerConfig setStrictThreadMode(boolean strictThreadMode)
      Indicates the server that the HTTP request/response interactions will happen exclusively on the expected thread when the threading model is event-loop.
      Parameters:
      strictThreadMode - whether to use the strict thread mode
      Returns:
      a reference to this, so the API can be used fluently
    • getObservabilityConfig

      public ObservabilityConfig getObservabilityConfig()
      Returns:
      the server observability config.
    • setObservabilityConfig

      public HttpServerConfig setObservabilityConfig(ObservabilityConfig observabilityConfig)
      Set the server observability config.
      Parameters:
      observabilityConfig - the server observability config
      Returns:
      a reference to this, so the API can be used fluently
    • getHttp1Config

      public Http1ServerConfig getHttp1Config()
      Returns:
      the configuration specific to the HTTP/1.x protocol.
    • setHttp1Config

      public HttpServerConfig setHttp1Config(Http1ServerConfig config)
      Set the HTTP/1.x configuration to use
      Parameters:
      config - the config
      Returns:
      a reference to this, so the API can be used fluently
    • getHttp2Config

      public Http2ServerConfig getHttp2Config()
      Returns:
      the configuration specific to the HTTP/2 protocol.
    • setHttp2Config

      public HttpServerConfig setHttp2Config(Http2ServerConfig config)
      Set the HTTP/2 configuration to use
      Parameters:
      config - the config
      Returns:
      a reference to this, so the API can be used fluently
    • getHttp3Config

      public Http3ServerConfig getHttp3Config()
      Returns:
      the configuration specific to the HTTP/1.x protocol.
    • setHttp3Config

      public HttpServerConfig setHttp3Config(Http3ServerConfig config)
      Set the HTTP/3 configuration to use
      Parameters:
      config - the config
      Returns:
      a reference to this, so the API can be used fluently
    • getWebSocketConfig

      public WebSocketServerConfig getWebSocketConfig()
      Returns:
      the configuration specific to the WebSocket protocol.
    • setWebSocketConfig

      public HttpServerConfig setWebSocketConfig(WebSocketServerConfig webSocketConfig)
      Set the WebSocket protocol specific configuration.
      Parameters:
      webSocketConfig - the WebSocket config
    • getCompressionConfig

      public CompressionConfig getCompressionConfig()
      Returns:
      the compression configuration
    • setCompressionConfig

      public HttpServerConfig setCompressionConfig(CompressionConfig compressionConfig)
      Configure the server compression, this overwrites any previously configuration.
      Parameters:
      compressionConfig - the new configuration
      Returns:
      a reference to this, so the API can be used fluently
    • getTcpConfig

      public TcpServerConfig getTcpConfig()
      Returns:
      the TCP transport config
    • getQuicConfig

      public QuicServerConfig getQuicConfig()
      Returns:
      the QUIC transport config