Class ServerConfiguration.Builder
- java.lang.Object
-
- io.helidon.webserver.ServerConfiguration.Builder
-
- All Implemented Interfaces:
Builder<ServerConfiguration>
,Supplier<ServerConfiguration>
- Enclosing interface:
- ServerConfiguration
public static final class ServerConfiguration.Builder extends Object implements Builder<ServerConfiguration>
AServerConfiguration
builder.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerConfiguration.Builder
addSocket(String name, int port, InetAddress bindAddress)
Adds an additional named server socket configuration.ServerConfiguration.Builder
addSocket(String name, SocketConfiguration socketConfiguration)
Adds an additional named server socket configuration.ServerConfiguration.Builder
addSocket(String name, Supplier<SocketConfiguration> socketConfigurationBuilder)
Adds an additional named server socket configuration builder.ServerConfiguration.Builder
allowedCipherSuite(List<String> cipherSuite)
Configures allowed SSL cipher suite.ServerConfiguration.Builder
backlog(int size)
Sets a maximum length of the queue of incoming connections.ServerConfiguration.Builder
bindAddress(InetAddress bindAddress)
Sets a local address for server to bind.ServerConfiguration
build()
Builds a new configuration instance.ServerConfiguration.Builder
clientAuth(ClientAuthentication clientAuthentication)
SetClientAuthentication
whether client authentication is required or not.ServerConfiguration.Builder
config(Config config)
Sets configuration values included in providedConfig
parameter.ServerConfiguration.Builder
context(Context context)
Configure the application scoped context to be used as a parent for webserver request contexts.ServerConfiguration.Builder
enabledSSlProtocols(String... protocols)
Configures the SSL protocols to enable with the default server socket.ServerConfiguration.Builder
enabledSSlProtocols(List<String> protocols)
Configures the SSL protocols to enable with the default server socket.ServerConfiguration.Builder
experimental(ExperimentalConfiguration experimental)
Configure experimental features.ServerConfiguration.Builder
maxHeaderSize(int size)
Configure maximal header size (all headers combined) in number of characters for default socket.ServerConfiguration.Builder
maxInitialLineLength(int length)
Configure maximal length of the initial HTTP line for default socket.ServerConfiguration.Builder
port(int port)
Sets server port.ServerConfiguration.Builder
receiveBufferSize(int bytes)
Propose value of the TCP receive window that is advertised to the remote peer.ServerConfiguration.Builder
ssl(Supplier<? extends SSLContext> sslContextBuilder)
SetsSSLContext
to to use with the server.ServerConfiguration.Builder
ssl(SSLContext sslContext)
SetsSSLContext
to to use with the server.ServerConfiguration.Builder
timeout(int milliseconds)
Sets a socket timeout in milliseconds or0
for infinite timeout.ServerConfiguration.Builder
tracer(Tracer tracer)
Sets an opentracing.io tracer.ServerConfiguration.Builder
tracer(Supplier<? extends Tracer> tracerBuilder)
Sets an opentracing.io tracer.ServerConfiguration.Builder
workersCount(int workers)
Sets a count of threads in pool used to tryProcess HTTP requests.
-
-
-
Method Detail
-
ssl
public ServerConfiguration.Builder ssl(SSLContext sslContext)
SetsSSLContext
to to use with the server. If notnull
then server enforce SSL communication.- Parameters:
sslContext
- ssl context- Returns:
- an updated builder
-
ssl
public ServerConfiguration.Builder ssl(Supplier<? extends SSLContext> sslContextBuilder)
SetsSSLContext
to to use with the server. If notnull
then server enforce SSL communication.- Parameters:
sslContextBuilder
- ssl context builder; will be built as a first step of this method execution- Returns:
- an updated builder
-
clientAuth
public ServerConfiguration.Builder clientAuth(ClientAuthentication clientAuthentication)
SetClientAuthentication
whether client authentication is required or not.- Parameters:
clientAuthentication
- client authentication- Returns:
- an updated builder
-
allowedCipherSuite
public ServerConfiguration.Builder allowedCipherSuite(List<String> cipherSuite)
Configures allowed SSL cipher suite.- Parameters:
cipherSuite
- allowed cipher suite- Returns:
- this builder
-
port
public ServerConfiguration.Builder port(int port)
Sets server port. If port is0
or less then any available ephemeral port will be used.Configuration key:
port
- Parameters:
port
- the server port- Returns:
- an updated builder
-
bindAddress
public ServerConfiguration.Builder bindAddress(InetAddress bindAddress)
Sets a local address for server to bind. Ifnull
then listens an all local addresses.Configuration key:
bind-address
- Parameters:
bindAddress
- the address to bind the server ornull
for all local addresses- Returns:
- an updated builder
-
backlog
public ServerConfiguration.Builder backlog(int size)
Sets a maximum length of the queue of incoming connections. Default value is1024
.Configuration key:
backlog
- Parameters:
size
- the maximum length of the queue of incoming connections- Returns:
- an updated builder
-
timeout
public ServerConfiguration.Builder timeout(int milliseconds)
Sets a socket timeout in milliseconds or0
for infinite timeout.Configuration key:
timeout
- Parameters:
milliseconds
- a socket timeout in milliseconds or0
- Returns:
- an updated builder
-
receiveBufferSize
public ServerConfiguration.Builder receiveBufferSize(int bytes)
Propose value of the TCP receive window that is advertised to the remote peer. If0
then implementation default is used.Configuration key:
receive-buffer
- Parameters:
bytes
- a buffer size in bytes or0
- Returns:
- an updated builder
-
maxHeaderSize
public ServerConfiguration.Builder maxHeaderSize(int size)
Configure maximal header size (all headers combined) in number of characters for default socket.- Parameters:
size
- header size- Returns:
- an updated builder
-
maxInitialLineLength
public ServerConfiguration.Builder maxInitialLineLength(int length)
Configure maximal length of the initial HTTP line for default socket.- Parameters:
length
- line length- Returns:
- an updated buidler
-
addSocket
public ServerConfiguration.Builder addSocket(String name, int port, InetAddress bindAddress)
Adds an additional named server socket configuration. As a result, the server will listen on multiple ports.An additional named server socket may have a dedicated
Routing
configured throughWebServer.Builder.addNamedRouting(String, Routing)
.- Parameters:
name
- the name of the additional server socket configurationport
- the port to bind; if0
or less, any available ephemeral port will be usedbindAddress
- the address to bind; ifnull
, all local addresses will be bound- Returns:
- an updated builder
-
addSocket
public ServerConfiguration.Builder addSocket(String name, SocketConfiguration socketConfiguration)
Adds an additional named server socket configuration. As a result, the server will listen on multiple ports.An additional named server socket may have a dedicated
Routing
configured throughWebServer.Builder.addNamedRouting(String, Routing)
.- Parameters:
name
- the name of the additional server socket configurationsocketConfiguration
- the additional named server socket configuration- Returns:
- an updated builder
-
addSocket
public ServerConfiguration.Builder addSocket(String name, Supplier<SocketConfiguration> socketConfigurationBuilder)
Adds an additional named server socket configuration builder. As a result, the server will listen on multiple ports.An additional named server socket may have a dedicated
Routing
configured throughWebServer.Builder.addNamedRouting(String, Routing)
.- Parameters:
name
- the name of the additional server socket configurationsocketConfigurationBuilder
- the additional named server socket configuration builder; will be built as a first step of this method execution- Returns:
- an updated builder
-
workersCount
public ServerConfiguration.Builder workersCount(int workers)
Sets a count of threads in pool used to tryProcess HTTP requests. Default value isCPU_COUNT * 2
.Configuration key:
workers
- Parameters:
workers
- a workers count- Returns:
- an updated builder
-
tracer
public ServerConfiguration.Builder tracer(Tracer tracer)
Sets an opentracing.io tracer. (Default isGlobalTracer
.)- Parameters:
tracer
- a tracer to set- Returns:
- an updated builder
-
tracer
public ServerConfiguration.Builder tracer(Supplier<? extends Tracer> tracerBuilder)
Sets an opentracing.io tracer. (Default isGlobalTracer
.)- Parameters:
tracerBuilder
- a tracer builder to set; will be built as a first step of this method execution- Returns:
- updated builder
-
enabledSSlProtocols
public ServerConfiguration.Builder enabledSSlProtocols(String... protocols)
Configures the SSL protocols to enable with the default server socket.- Parameters:
protocols
- protocols to enable, ifnull
enables the default protocols- Returns:
- an updated builder
-
enabledSSlProtocols
public ServerConfiguration.Builder enabledSSlProtocols(List<String> protocols)
Configures the SSL protocols to enable with the default server socket.- Parameters:
protocols
- protocols to enable, ifnull
or empty enables the default protocols- Returns:
- an updated builder
-
experimental
public ServerConfiguration.Builder experimental(ExperimentalConfiguration experimental)
Configure experimental features.- Parameters:
experimental
- experimental configuration- Returns:
- an updated builder
-
context
public ServerConfiguration.Builder context(Context context)
Configure the application scoped context to be used as a parent for webserver request contexts.- Parameters:
context
- top level context- Returns:
- an updated builder
-
config
public ServerConfiguration.Builder config(Config config)
Sets configuration values included in providedConfig
parameter.It can be used for configuration externalisation.
All parameters sets before this method call can be seen as defaults and all parameters sets after can be seen as forced.
- Parameters:
config
- the configuration to use- Returns:
- an updated builder
-
build
public ServerConfiguration build()
Builds a new configuration instance.- Specified by:
build
in interfaceBuilder<ServerConfiguration>
- Returns:
- a new instance
-
-