-
- All Known Subinterfaces:
ServerConfiguration
public interface SocketConfiguration
The SocketConfiguration configures a port to listen on and its associated server socket parameters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SocketConfiguration.Builder
TheSocketConfiguration
builder class.static class
SocketConfiguration.RequestedUriDiscoveryType
Types of discovery of frontend uri.static interface
SocketConfiguration.SocketConfigurationBuilder<B extends SocketConfiguration.SocketConfigurationBuilder<B>>
Socket configuration builder API, used bySocketConfiguration.Builder
to configure additional sockets, and byWebServer.Builder
to configure the default socket.
-
Field Summary
Fields Modifier and Type Field Description static SocketConfiguration
DEFAULT
Deprecated.since 2.0.0 This configuration does not contain a name and will be removedstatic int
DEFAULT_BACKLOG_SIZE
The default backlog size to configure the server sockets with if no other value is provided.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description Set<String>
allowedCipherSuite()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().cipherSuite()
instead.int
backlog()
Returns a maximum length of the queue of incoming connections on the server socket.default long
backpressureBufferSize()
Maximum length of the response data sending buffer can keep without flushing.default BackpressureStrategy
backpressureStrategy()
Strategy for applying backpressure to the reactive stream of response data.InetAddress
bindAddress()
Returns local address where the server listens on with the server socket.static SocketConfiguration.Builder
builder()
Creates a builder ofSocketConfiguration
class.ClientAuthentication
clientAuth()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().clientAuth()
instead.default int
connectionIdleTimeout()
Timeout seconds after which any idle connection will be automatically closed by the server.default boolean
continueImmediately()
When true WebServer answers with 100 continue immediately, not waiting for user to actually request the data.static SocketConfiguration
create(String name)
Create a default named configuration.default boolean
enableCompression()
Whether to allow negotiation for a gzip/deflate content encoding.default boolean
enabled()
Whether this socket is enabled (and will be opened on server startup), or disabled (and ignored on server startup).Set<String>
enabledSslProtocols()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().enabledTlsProtocols()
instead.int
initialBufferSize()
Initial size of the buffer used to parse HTTP line and headers.int
maxChunkSize()
Maximal size of a single chunk of received data.int
maxHeaderSize()
Maximal size of all headers combined.int
maxInitialLineLength()
Maximal length of the initial HTTP line.default long
maxPayloadSize()
Maximum size allowed for an HTTP payload in a client request.default String
name()
Name of this socket.int
port()
Returns a server port to listen on with the server socket.int
receiveBufferSize()
Returns proposed value of the TCP receive window that is advertised to the remote peer on the server socket.boolean
requestedUriDiscoveryEnabled()
List<SocketConfiguration.RequestedUriDiscoveryType>
requestedUriDiscoveryTypes()
Discovery types to identify requested URI.SSLContext
ssl()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().sslContext()
instead.int
timeoutMillis()
Returns a server socket timeout in milliseconds or0
for an infinite timeout.Optional<WebServerTls>
tls()
Return aWebServerTls
containing server TLS configuration.AllowList
trustedProxies()
The allow list for trusted proxies.boolean
validateHeaders()
Whether to validate HTTP header names.
-
-
-
Field Detail
-
DEFAULT
@Deprecated static final SocketConfiguration DEFAULT
Deprecated.since 2.0.0 This configuration does not contain a name and will be removedThe default socket configuration.
-
DEFAULT_BACKLOG_SIZE
static final int DEFAULT_BACKLOG_SIZE
The default backlog size to configure the server sockets with if no other value is provided.- See Also:
- Constant Field Values
-
-
Method Detail
-
name
default String name()
Name of this socket. Default toWebServer.DEFAULT_SOCKET_NAME
for the main and default server socket. All other sockets must be named.- Returns:
- name of this socket
-
port
int port()
Returns a server port to listen on with the server socket. If port is0
then any available ephemeral port will be used.- Returns:
- the server port of the server socket
-
bindAddress
InetAddress bindAddress()
Returns local address where the server listens on with the server socket. Ifnull
then listens an all local addresses.- Returns:
- an address to bind with the server socket;
null
for all local addresses
-
backlog
int backlog()
Returns a maximum length of the queue of incoming connections on the server socket.Default value is
DEFAULT_BACKLOG_SIZE
.- Returns:
- a maximum length of the queue of incoming connections
-
timeoutMillis
int timeoutMillis()
Returns a server socket timeout in milliseconds or0
for an infinite timeout.- Returns:
- a server socket timeout in milliseconds or
0
-
receiveBufferSize
int receiveBufferSize()
Returns proposed value of the TCP receive window that is advertised to the remote peer on the server socket.If
0
then use implementation default.- Returns:
- a buffer size in bytes of the server socket or
0
-
tls
Optional<WebServerTls> tls()
Return aWebServerTls
containing server TLS configuration. When emptyOptional
is returned no TLS should be configured.- Returns:
- web server tls configuration
-
ssl
@Deprecated(since="2.3.1", forRemoval=true) SSLContext ssl()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().sslContext()
instead. This method will be removed at 3.0.0 version.Returns aSSLContext
to use with the server socket. If notnull
then the server enforces an SSL communication.- Returns:
- a SSL context to use
-
enabledSslProtocols
@Deprecated(since="2.3.1", forRemoval=true) Set<String> enabledSslProtocols()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().enabledTlsProtocols()
instead. This method will be removed at 3.0.0 version.Returns the SSL protocols to enable, ornull
to enable the default protocols.- Returns:
- the SSL protocols to enable
-
allowedCipherSuite
@Deprecated(since="2.3.1", forRemoval=true) Set<String> allowedCipherSuite()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().cipherSuite()
instead. This method will be removed at 3.0.0 version.Return the allowed cipher suite of the TLS. If empty set is returned, the default cipher suite is used.- Returns:
- the allowed cipher suite
-
clientAuth
@Deprecated(since="2.3.1", forRemoval=true) ClientAuthentication clientAuth()
Deprecated, for removal: This API element is subject to removal in a future version.usetls().clientAuth()
instead. This method will be removed at 3.0.0 version.Whether to require client authentication or not.- Returns:
- client authentication
-
enabled
default boolean enabled()
Whether this socket is enabled (and will be opened on server startup), or disabled (and ignored on server startup).- Returns:
true
for enabled socket,false
for socket that should not be opened
-
maxHeaderSize
int maxHeaderSize()
Maximal size of all headers combined.- Returns:
- size in bytes
-
maxInitialLineLength
int maxInitialLineLength()
Maximal length of the initial HTTP line.- Returns:
- length
-
maxChunkSize
int maxChunkSize()
Maximal size of a single chunk of received data.- Returns:
- chunk size
-
validateHeaders
boolean validateHeaders()
Whether to validate HTTP header names. When set totrue
, we make sure the header name is a valid string- Returns:
true
if headers should be validated
-
enableCompression
default boolean enableCompression()
Whether to allow negotiation for a gzip/deflate content encoding. Supporting HTTP compression may interfere with application that use streaming and other similar features. Thus, it defaults tofalse
.- Returns:
- compression flag
-
maxPayloadSize
default long maxPayloadSize()
Maximum size allowed for an HTTP payload in a client request. A negative value indicates that there is no maximum set.- Returns:
- maximum payload size
-
backpressureBufferSize
default long backpressureBufferSize()
Maximum length of the response data sending buffer can keep without flushing. Depends on `backpressure-policy` what happens if max buffer size is reached.- Returns:
- maximum non-flushed data Netty can buffer until backpressure is applied
-
backpressureStrategy
default BackpressureStrategy backpressureStrategy()
Strategy for applying backpressure to the reactive stream of response data. Switched default toBackpressureStrategy.AUTO_FLUSH
since 2.5.7.- Returns:
- strategy identifier for applying backpressure
-
continueImmediately
default boolean continueImmediately()
When true WebServer answers with 100 continue immediately, not waiting for user to actually request the data. False is default value.- Returns:
- strategy identifier for applying backpressure
-
initialBufferSize
int initialBufferSize()
Initial size of the buffer used to parse HTTP line and headers.- Returns:
- initial size of the buffer
-
requestedUriDiscoveryTypes
List<SocketConfiguration.RequestedUriDiscoveryType> requestedUriDiscoveryTypes()
Discovery types to identify requested URI.- Returns:
- list with supported types, will always contain at least
SocketConfiguration.RequestedUriDiscoveryType.HOST
.
-
requestedUriDiscoveryEnabled
boolean requestedUriDiscoveryEnabled()
- Returns:
- whether requested URI discovery is enabled.
-
trustedProxies
AllowList trustedProxies()
The allow list for trusted proxies.- Returns:
- allow list for trusted proxies
-
connectionIdleTimeout
default int connectionIdleTimeout()
Timeout seconds after which any idle connection will be automatically closed by the server.- Returns:
- idle connection timeout in seconds
-
builder
static SocketConfiguration.Builder builder()
Creates a builder ofSocketConfiguration
class.- Returns:
- a builder
-
create
static SocketConfiguration create(String name)
Create a default named configuration.- Parameters:
name
- name of the socket- Returns:
- a new socket configuration with defaults
-
-