Class HttpServerConfig
HttpServer- Author:
- Julien Viet
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault port the server will listen on = 443static final longstatic final longstatic final longstatic final longstatic final longstatic final longstatic final Set<HttpVersion> -
Constructor Summary
ConstructorsConstructorDescriptionCreate a default configuration of a server accepting HTTP/1.1 and HTTP/2 protocols.HttpServerConfig(HttpServerConfig other) Copy constructorHttpServerConfig(HttpServerOptions options) Copies theHttpServerOptions. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanintbooleansetCompressionConfig(CompressionConfig compressionConfig) Configure the server compression, this overwrites any previously configuration.setFormDecoderConfig(FormDecoderConfig formDecoderConfig) setHandle100ContinueAutomatically(boolean handle100ContinueAutomatically) Set whether 100 Continue should be handled automaticallySet the host used to bind the server at, affecting both TCP and QUIC transports.setHttp1Config(Http1ServerConfig config) Set the HTTP/1.x configuration to usesetHttp2Config(Http2ServerConfig config) Set the HTTP/2 configuration to usesetHttp3Config(Http3ServerConfig config) Set the HTTP/3 configuration to usesetIdleTimeout(Duration idleTimeout) Set the idle timeout, zero ornullmeans don't time out.setLogConfig(LogConfig config) Configure the per stream networking logging: Netty's stream pipeline is configured for logging on Netty's logger.setObservabilityConfig(ObservabilityConfig observabilityConfig) Set the server observability config.setPort(int port) Set the port used to bind the server at, affecting both TCP and QUIC transports.setQueryParamConfig(QueryParamDecoderConfig queryParamDecoderConfig) Set the configuration for parsing HTTP request query parameters.setQuicHost(String host) Set the hostsetQuicPort(int port) Set the port used to bind the QUIC server.setReadIdleTimeout(Duration idleTimeout) Set the read idle timeout, zero ornullmeans or null means don't time out.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.setTcpHost(String host) Set the hostsetTcpPort(int port) Set the port used to bind the TCP server.setVersions(HttpVersion... versions) Set the HTTP versions.setVersions(Set<HttpVersion> versions) Set the HTTP versions.setWebSocketConfig(WebSocketServerConfig webSocketConfig) Set the WebSocket protocol specific configuration.setWriteIdleTimeout(Duration idleTimeout) Set the write idle timeout, zero ornullmeans don't time out.
-
Field Details
-
DEFAULT_HTTP3_PORT
public static final int DEFAULT_HTTP3_PORTDefault port the server will listen on = 443- See Also:
-
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
Copies theHttpServerOptions.- 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
Copy constructor- Parameters:
other- the config to be copied
-
-
Method Details
-
setIdleTimeout
Set the idle timeout, zero ornullmeans 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
Set the read idle timeout, zero or
nullmeans 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
Set the write idle timeout, zero or
nullmeans 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
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,nullmeans disabled- Returns:
- a reference to this, so the API can be used fluently
-
getVersions
- Returns:
- the HTTP versions
-
setVersions
Set the HTTP versions.- Parameters:
versions- the versions- Returns:
- a reference to this, so the API can be used fluently
-
setVersions
Set the HTTP versions.- Parameters:
versions- the versions- Returns:
- a reference to this, so the API can be used fluently
-
setPort
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
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
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
- Returns:
- the host
-
setTcpHost
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
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
- Returns:
- the host
-
setQuicHost
Set the host- Parameters:
host- the host- Returns:
- a reference to this, so the API can be used fluently
-
getFormDecoderConfig
-
setFormDecoderConfig
-
getQueryParamConfig
- Returns:
- the configuration for parsing HTTP request query parameters, when the configuration is
null, the default configuration is used: - See Also:
-
setQueryParamConfig
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
Set whether 100 Continue should be handled automatically- Parameters:
handle100ContinueAutomatically-trueif 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
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
- Returns:
- the server observability config.
-
setObservabilityConfig
Set the server observability config.- Parameters:
observabilityConfig- the server observability config- Returns:
- a reference to this, so the API can be used fluently
-
getHttp1Config
- Returns:
- the configuration specific to the HTTP/1.x protocol.
-
setHttp1Config
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
- Returns:
- the configuration specific to the HTTP/2 protocol.
-
setHttp2Config
Set the HTTP/2 configuration to use- Parameters:
config- the config- Returns:
- a reference to this, so the API can be used fluently
-
getHttp3Config
- Returns:
- the configuration specific to the HTTP/1.x protocol.
-
setHttp3Config
Set the HTTP/3 configuration to use- Parameters:
config- the config- Returns:
- a reference to this, so the API can be used fluently
-
getWebSocketConfig
- Returns:
- the configuration specific to the WebSocket protocol.
-
setWebSocketConfig
Set the WebSocket protocol specific configuration.- Parameters:
webSocketConfig- the WebSocket config
-
getCompressionConfig
- Returns:
- the compression configuration
-
setCompressionConfig
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
- Returns:
- the TCP transport config
-
getQuicConfig
- Returns:
- the QUIC transport config
-