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 by
SocketConfiguration.Builder
to configure additional sockets, and by WebServer.Builder to
configure the default socket.-
Method Summary
Modifier and TypeMethodDescriptionbacklog(int backlog) Configures a maximum length of the queue of incoming connections on the server socket.default BbindAddress(String address) Configures local address where the server listens on with the server socket.bindAddress(InetAddress bindAddress) Configures local address where the server listens on with the server socket.default BUpdate this socket configuration from aConfig.enableCompression(boolean value) Enable negotiation for gzip/deflate content encodings.default BA helper method that just callsbindAddress(String).maxHeaderSize(int size) Maximal number of bytes of all header values combined.maxInitialLineLength(int length) Maximal number of characters in the initial HTTP line.maxPayloadSize(long size) Set a maximum payload size for a client request.port(int port) Configures a server port to listen on with the server socket.receiveBufferSize(int receiveBufferSize) Configures proposed value of the TCP receive window that is advertised to the remote peer on the server socket.Configures a server socket timeout.tls(WebServerTls webServerTls) Configures SSL for this socket.default Btls(Supplier<WebServerTls> tlsConfig) Configures SSL for this socket.
-
Method Details
-
port
Configures a server port to listen on with the server socket. If port is0then any available ephemeral port will be used.- Parameters:
port- the server port of the server socket- Returns:
- this builder
-
bindAddress
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
A helper method that just callsbindAddress(String).- Parameters:
address- host to listen on- Returns:
- this builder
-
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
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
Configures a server socket timeout.- Parameters:
amount- an amount of time to configure the timeout, use0for infinite timeoutunit- time unit to use with the configured amount- Returns:
- this builder
-
receiveBufferSize
Configures proposed value of the TCP receive window that is advertised to the remote peer on the server socket.If
0then use implementation default.- Parameters:
receiveBufferSize- a buffer size in bytes of the server socket or0- Returns:
- this builder
-
tls
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
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
Maximal number of bytes of all header values combined. When a bigger value is received, aHttp.Status.BAD_REQUEST_400is returned.Default is
8192- Parameters:
size- maximal number of bytes of combined header values- Returns:
- this builder
-
maxInitialLineLength
Maximal number of characters in the initial HTTP line.Default is
4096- Parameters:
length- maximal number of characters- Returns:
- this builder
-
enableCompression
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
Set a maximum payload size for a client request. Can prevent DoS attacks.- Parameters:
size- maximum payload size- Returns:
- this builder
-
config
Update this socket configuration from aConfig.- Parameters:
config- configuration on the node of a socket- Returns:
- updated builder instance
-