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>
AServerConfigurationbuilder.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerConfiguration.BuilderaddSocket(String name, int port, InetAddress bindAddress)Adds an additional named server socket configuration.ServerConfiguration.BuilderaddSocket(String name, SocketConfiguration socketConfiguration)Adds an additional named server socket configuration.ServerConfiguration.BuilderaddSocket(String name, Supplier<SocketConfiguration> socketConfigurationBuilder)Adds an additional named server socket configuration builder.ServerConfiguration.BuilderallowedCipherSuite(List<String> cipherSuite)Configures allowed SSL cipher suite.ServerConfiguration.Builderbacklog(int size)Sets a maximum length of the queue of incoming connections.ServerConfiguration.BuilderbindAddress(InetAddress bindAddress)Sets a local address for server to bind.ServerConfigurationbuild()Builds a new configuration instance.ServerConfiguration.BuilderclientAuth(ClientAuthentication clientAuthentication)SetClientAuthenticationwhether client authentication is required or not.ServerConfiguration.Builderconfig(Config config)Sets configuration values included in providedConfigparameter.ServerConfiguration.Buildercontext(Context context)Configure the application scoped context to be used as a parent for webserver request contexts.ServerConfiguration.BuilderenabledSSlProtocols(String... protocols)Configures the SSL protocols to enable with the default server socket.ServerConfiguration.BuilderenabledSSlProtocols(List<String> protocols)Configures the SSL protocols to enable with the default server socket.ServerConfiguration.Builderexperimental(ExperimentalConfiguration experimental)Configure experimental features.ServerConfiguration.BuildermaxHeaderSize(int size)Configure maximal header size (all headers combined) in number of characters for default socket.ServerConfiguration.BuildermaxInitialLineLength(int length)Configure maximal length of the initial HTTP line for default socket.ServerConfiguration.Builderport(int port)Sets server port.ServerConfiguration.BuilderreceiveBufferSize(int bytes)Propose value of the TCP receive window that is advertised to the remote peer.ServerConfiguration.Builderssl(Supplier<? extends SSLContext> sslContextBuilder)SetsSSLContextto to use with the server.ServerConfiguration.Builderssl(SSLContext sslContext)SetsSSLContextto to use with the server.ServerConfiguration.Buildertimeout(int milliseconds)Sets a socket timeout in milliseconds or0for infinite timeout.ServerConfiguration.Buildertracer(Tracer tracer)Sets an opentracing.io tracer.ServerConfiguration.Buildertracer(Supplier<? extends Tracer> tracerBuilder)Sets an opentracing.io tracer.ServerConfiguration.BuilderworkersCount(int workers)Sets a count of threads in pool used to tryProcess HTTP requests.
-
-
-
Method Detail
-
ssl
public ServerConfiguration.Builder ssl(SSLContext sslContext)
SetsSSLContextto to use with the server. If notnullthen server enforce SSL communication.- Parameters:
sslContext- ssl context- Returns:
- an updated builder
-
ssl
public ServerConfiguration.Builder ssl(Supplier<? extends SSLContext> sslContextBuilder)
SetsSSLContextto to use with the server. If notnullthen 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)
SetClientAuthenticationwhether 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 is0or 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. Ifnullthen listens an all local addresses.Configuration key:
bind-address- Parameters:
bindAddress- the address to bind the server ornullfor 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 or0for 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. If0then 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
Routingconfigured throughWebServer.Builder.addNamedRouting(String, Routing).- Parameters:
name- the name of the additional server socket configurationport- the port to bind; if0or 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
Routingconfigured 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
Routingconfigured 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, ifnullenables 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, ifnullor 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 providedConfigparameter.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:
buildin interfaceBuilder<ServerConfiguration>- Returns:
- a new instance
-
-