Module io.helidon.webserver
Package io.helidon.webserver
Interface SocketConfiguration.SocketConfigurationBuilder<B extends SocketConfiguration.SocketConfigurationBuilder<B>>
-
- Type Parameters:
B
- type of the subclass of this class to provide correct fluent API
- All Known Implementing Classes:
ServerConfiguration.Builder
,SocketConfiguration.Builder
,WebServer.Builder
- Enclosing interface:
- SocketConfiguration
public 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 String
REQUESTED_URI_DISCOVERY_CONFIG_KEY_PREFIX
Config key prefix for requested URI discovery settings.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description B
addRequestedUriDiscoveryType(SocketConfiguration.RequestedUriDiscoveryType type)
Adds a type of front-end URI discovery Helidon should use for this socket.B
backlog(int backlog)
Configures a maximum length of the queue of incoming connections on the server socket.B
backpressureBufferSize(long size)
Maximum length of the response data sending buffer can keep without flushing.B
backpressureStrategy(BackpressureStrategy backpressureStrategy)
Sets a backpressure strategy for the server to apply against user provided response upstream.default B
bindAddress(String address)
Configures local address where the server listens on with the server socket.B
bindAddress(InetAddress bindAddress)
Configures local address where the server listens on with the server socket.default B
config(Config config)
Update this socket configuration from aConfig
.B
connectionIdleTimeout(int seconds)
Sets the number of seconds after which an idle connection will be automatically closed by the server.B
continueImmediately(boolean continueImmediately)
When true WebServer answers to expect continue with 100 continue immediately, not waiting for user to actually request the data.B
enableCompression(boolean value)
Enable negotiation for gzip/deflate content encodings.default B
host(String address)
A helper method that just callsbindAddress(String)
.B
maxHeaderSize(int size)
Maximal number of bytes of all header values combined.B
maxInitialLineLength(int length)
Maximal number of characters in the initial HTTP line.B
maxPayloadSize(long size)
Set a maximum payload size for a client request.B
port(int port)
Configures a server port to listen on with the server socket.B
receiveBufferSize(int receiveBufferSize)
Configures proposed value of the TCP receive window that is advertised to the remote peer on the server socket.B
requestedUriDiscoveryEnabled(boolean enabled)
Sets whether requested URI discovery is enabled for the socket.B
requestedUriDiscoveryTypes(List<SocketConfiguration.RequestedUriDiscoveryType> types)
Assigns the front-end URI discovery type(s) this socket should use.B
timeout(long amount, TimeUnit unit)
Configures a server socket timeout.B
tls(WebServerTls webServerTls)
Configures SSL for this socket.default B
tls(Supplier<WebServerTls> tlsConfig)
Configures SSL for this socket.B
trustedProxies(AllowList trustedProxies)
Assigns the settings governing the acceptance and rejection of forwarded headers from incoming requests to this socket.
-
-
-
Field Detail
-
REQUESTED_URI_DISCOVERY_CONFIG_KEY_PREFIX
static final String REQUESTED_URI_DISCOVERY_CONFIG_KEY_PREFIX
Config key prefix for requested URI discovery settings.- See Also:
- Constant Field Values
-
-
Method Detail
-
port
B port(int port)
Configures a server port to listen on with the server socket. If port is0
then any available ephemeral port will be used.- Parameters:
port
- the server port of the server socket- Returns:
- this builder
-
bindAddress
default B bindAddress(String address)
Configures local address where the server listens on with the server socket. If not configured, then listens an all local addresses.- Parameters:
address
- an address to bind with the server socket- Returns:
- this builder
- Throws:
NullPointerException
- in case the bind address is nullConfigException
- in case the address provided is not a valid host address
-
host
default B host(String address)
A helper method that just callsbindAddress(String)
.- Parameters:
address
- host to listen on- Returns:
- this builder
-
bindAddress
B bindAddress(InetAddress bindAddress)
Configures local address where the server listens on with the server socket. If not configured, then listens an all local addresses.- Parameters:
bindAddress
- an address to bind with the server socket- Returns:
- this builder
- Throws:
NullPointerException
- in case the bind address is null
-
backlog
B backlog(int backlog)
Configures a maximum length of the queue of incoming connections on the server socket.Default value is
SocketConfiguration.DEFAULT_BACKLOG_SIZE
.- Parameters:
backlog
- a maximum length of the queue of incoming connections- Returns:
- this builder
-
timeout
B timeout(long amount, TimeUnit unit)
Configures a server socket timeout.- Parameters:
amount
- an amount of time to configure the timeout, use0
for infinite timeoutunit
- time unit to use with the configured amount- Returns:
- this builder
-
receiveBufferSize
B receiveBufferSize(int receiveBufferSize)
Configures proposed value of the TCP receive window that is advertised to the remote peer on the server socket.If
0
then use implementation default.- Parameters:
receiveBufferSize
- a buffer size in bytes of the server socket or0
- Returns:
- this builder
-
tls
B tls(WebServerTls webServerTls)
Configures SSL for this socket. When configured, the server enforces SSL configuration. If this method is called, any other method except fortls(java.util.function.Supplier)
ยจ and repeated invocation of this method would be ignored.If this method is called again, the previous configuration would be ignored.
- Parameters:
webServerTls
- ssl configuration to use with this socket- Returns:
- this builder
-
tls
default B tls(Supplier<WebServerTls> tlsConfig)
Configures SSL for this socket. When configured, the server enforces SSL configuration.- Parameters:
tlsConfig
- supplier ssl configuration to use with this socket- Returns:
- this builder
-
maxHeaderSize
B maxHeaderSize(int size)
Maximal number of bytes of all header values combined. When a bigger value is received, aHttp.Status.BAD_REQUEST_400
is returned.Default is
16384
- Parameters:
size
- maximal number of bytes of combined header values- Returns:
- this builder
-
maxInitialLineLength
B maxInitialLineLength(int length)
Maximal number of characters in the initial HTTP line.Default is
4096
- Parameters:
length
- maximal number of characters- Returns:
- this builder
-
enableCompression
B enableCompression(boolean value)
Enable negotiation for gzip/deflate content encodings. Clients can request compression using the "Accept-Encoding" header.Default is
false
- Parameters:
value
- compression flag- Returns:
- this builder
-
maxPayloadSize
B maxPayloadSize(long size)
Set a maximum payload size for a client request. Can prevent DoS attacks.- Parameters:
size
- maximum payload size- Returns:
- this builder
-
backpressureBufferSize
B backpressureBufferSize(long size)
Maximum length of the response data sending buffer can keep without flushing. Depends on `backpressure-policy` what happens if max buffer size is reached.- Parameters:
size
- maximum non-flushed data Netty can buffer until backpressure is applied- Returns:
- this builder
-
backpressureStrategy
B backpressureStrategy(BackpressureStrategy backpressureStrategy)
Sets a backpressure strategy for the server to apply against user provided response upstream.- LINEAR - Data are requested one-by-one, in case buffer reaches watermark, no other data is requested.
- AUTO_FLUSH - Data are requested one-by-one, in case buffer reaches watermark, no other data is requested.
- PREFETCH - After first data chunk arrives, probable number of chunks needed to fill the buffer up to watermark is calculated and requested.
- NONE - No backpressure is applied, Long.MAX_VALUE(unbounded) is requested from upstream.
- Parameters:
backpressureStrategy
- One of NONE, PREFETCH, LINEAR or AUTO_FLUSH, default is AUTO_FLUSH- Returns:
- this builder
-
continueImmediately
B continueImmediately(boolean continueImmediately)
When true WebServer answers to expect continue with 100 continue immediately, not waiting for user to actually request the data.Default is
false
- Parameters:
continueImmediately
- , answer with 100 continue immediately after expect continue, default is false- Returns:
- this builder
-
addRequestedUriDiscoveryType
B addRequestedUriDiscoveryType(SocketConfiguration.RequestedUriDiscoveryType type)
Adds a type of front-end URI discovery Helidon should use for this socket. Adding a discovery type automatically enables discovery for the socket.- Parameters:
type
- type to add- Returns:
- updated builder
-
requestedUriDiscoveryTypes
B requestedUriDiscoveryTypes(List<SocketConfiguration.RequestedUriDiscoveryType> types)
Assigns the front-end URI discovery type(s) this socket should use. This setting automatically enables discovery for the socket.- Parameters:
types
-SocketConfiguration.RequestedUriDiscoveryType
values to assign- Returns:
- updated builder
- See Also:
addRequestedUriDiscoveryType(io.helidon.webserver.SocketConfiguration.RequestedUriDiscoveryType)
,requestedUriDiscoveryEnabled(boolean)
,ServerRequest.requestedUri()
-
requestedUriDiscoveryEnabled
B requestedUriDiscoveryEnabled(boolean enabled)
Sets whether requested URI discovery is enabled for the socket.- Parameters:
enabled
- whether to enable discovery- Returns:
- updated builder
- See Also:
ServerRequest.requestedUri()
-
trustedProxies
B trustedProxies(AllowList trustedProxies)
Assigns the settings governing the acceptance and rejection of forwarded headers from incoming requests to this socket. This setting automatically enables discovery for the socket.- Parameters:
trustedProxies
- to apply to forwarded headers- Returns:
- updated builder
- See Also:
ServerRequest.requestedUri()
-
connectionIdleTimeout
B connectionIdleTimeout(int seconds)
Sets the number of seconds after which an idle connection will be automatically closed by the server.- Parameters:
seconds
- time in seconds- Returns:
- updated builder
-
-