Class ListenerConfig.BuilderBase<BUILDER extends ListenerConfig.BuilderBase<BUILDER,PROTOTYPE>,PROTOTYPE extends ListenerConfig>
- Type Parameters:
BUILDER- type of the builder extending this abstract builderPROTOTYPE- type of the prototype interface that would be built byPrototype.Builder.buildPrototype()
- All Implemented Interfaces:
Prototype.Builder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,,PROTOTYPE> ConfigBuilderSupport.ConfiguredBuilder<BUILDER,PROTOTYPE>
- Direct Known Subclasses:
ListenerConfig.Builder,WebServerConfig.BuilderBase
- Enclosing interface:
ListenerConfig
ListenerConfig.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classGenerated implementation of the prototype, can be extended by descendant prototype implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddConnectionSelector(ServerConnectionSelector connectionSelector) Explicitly defined connection selectors to be used with this socket.addConnectionSelectors(List<? extends ServerConnectionSelector> connectionSelectors) Explicitly defined connection selectors to be used with this socket.addListenerSocketOptions(Map<SocketOption<?>, ?> listenerSocketOptions) Server listener socket options.addProtocol(ProtocolConfig protocol) Configuration of protocols.addProtocols(List<? extends ProtocolConfig> protocols) Configuration of protocols.address()Address to use.address(InetAddress address) Address to use.addRouting(Builder<?, ? extends Routing> routing) List of all routings (possibly for multiple protocols).addRoutings(List<Builder<?, ? extends Routing>> routings) List of all routings (possibly for multiple protocols).intbacklog()Accept backlog.backlog(int backlog) Accept backlog.The address to bind to.bindAddress(SocketAddress bindAddress) The address to bind to.Clear existing value of bindAddress.Clear existing value of concurrencyLimit.Deprecated, for removal: This API element is subject to removal in a future version.Clear all connectionSelectors.Clear existing value of contentEncoding.Clear existing value of directHandlers.Clear existing value of listenerContext.Clear existing value of mediaContext.Clear all protocols.Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().Clear existing value of requestedUriDiscoveryContext.Clear existing value of routing.Clear all routings.clearTls()Clear existing value of tls.Concurrency limit to use to limit concurrent execution of incoming requests.concurrencyLimit(Limit concurrencyLimit) Concurrency limit to use to limit concurrent execution of incoming requests.booleanService discovery flag forconcurrencyLimit().concurrencyLimitDiscoverServices(boolean concurrencyLimitDiscoverServices) Service discovery flag forconcurrencyLimit().config()Configuration used to configure this instance.Deprecated.Update builder from configuration (node of this type).Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadconnectionConfig(ConnectionConfig connectionConfig) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadconnectionConfig(Consumer<ConnectionConfig.Builder> consumer) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadconnectionConfig(Supplier<? extends ConnectionConfig> supplier) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadOptions for connections accepted by this listener.connectionOptions(SocketOptions connectionOptions) Options for connections accepted by this listener.connectionOptions(Consumer<SocketOptions.Builder> consumer) Options for connections accepted by this listener.connectionOptions(Supplier<? extends SocketOptions> supplier) Options for connections accepted by this listener.Explicitly defined connection selectors to be used with this socket.connectionSelectors(List<? extends ServerConnectionSelector> connectionSelectors) Explicitly defined connection selectors to be used with this socket.Configure the listener specificContentEncodingContext.contentEncoding(ContentEncodingContext contentEncoding) Configure the listener specificContentEncodingContext.contentEncoding(ContentEncodingContextConfig contentEncoding) Configure the listener specificContentEncodingContext.Configure the listener specificContentEncodingContext.contentEncoding(Supplier<? extends ContentEncodingContext> supplier) Configure the listener specificContentEncodingContext.Direct handlers specific for this listener.directHandlers(DirectHandlers directHandlers) Direct handlers specific for this listener.directHandlers(Consumer<DirectHandlers.Builder> consumer) Direct handlers specific for this listener.directHandlers(Supplier<? extends DirectHandlers> supplier) Direct handlers specific for this listener.booleanEnable proxy protocol support for this socket.enableProxyProtocol(boolean enableProxyProtocol) Enable proxy protocol support for this socket.Configuration for this listener's error handling.errorHandling(ErrorHandling errorHandling) Configuration for this listener's error handling.errorHandling(Consumer<ErrorHandling.Builder> consumer) Configuration for this listener's error handling.errorHandling(Supplier<? extends ErrorHandling> supplier) Configuration for this listener's error handling.from(ListenerConfig prototype) Update this builder from an existing prototype instance.from(ListenerConfig.BuilderBase<?, ?> builder) Update this builder from an existing prototype builder instance.host()Host of the default socket.Host of the default socket.How often should we check foridleConnectionTimeout().idleConnectionPeriod(Duration idleConnectionPeriod) How often should we check foridleConnectionTimeout().How long should we wait before closing a connection that has no traffic on it.idleConnectionTimeout(Duration idleConnectionTimeout) How long should we wait before closing a connection that has no traffic on it.booleanIf set totrue, any named routing configured that does not have an associated named listener will NOT cause an exception to be thrown (default behavior is to throw an exception).ignoreInvalidNamedRouting(boolean ignoreInvalidNamedRouting) If set totrue, any named routing configured that does not have an associated named listener will NOT cause an exception to be thrown (default behavior is to throw an exception).Listener scoped context to be used as a parent for webserver request contexts (if used).listenerContext(Context listenerContext) Listener scoped context to be used as a parent for webserver request contexts (if used).listenerContext(Consumer<Context.Builder> consumer) Listener scoped context to be used as a parent for webserver request contexts (if used).listenerContext(Supplier<? extends Context> supplier) Listener scoped context to be used as a parent for webserver request contexts (if used).Map<SocketOption<?>, Object> Server listener socket options.listenerSocketOptions(Map<SocketOption<?>, ?> listenerSocketOptions) Server listener socket options.intLimits the number of requests that can be executed at the same time (the number of active virtual threads of requests).maxConcurrentRequests(int maxConcurrentRequests) Limits the number of requests that can be executed at the same time (the number of active virtual threads of requests).intIf the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance when writing it.maxInMemoryEntity(int maxInMemoryEntity) If the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance when writing it.longMaximal number of bytes an entity may have.maxPayloadSize(long maxPayloadSize) Maximal number of bytes an entity may have.intLimits the number of connections that can be opened at a single point in time.maxTcpConnections(int maxTcpConnections) Limits the number of connections that can be opened at a single point in time.Configure the listener specificMediaContext.mediaContext(MediaContext mediaContext) Configure the listener specificMediaContext.mediaContext(MediaContextConfig mediaContext) Configure the listener specificMediaContext.mediaContext(Consumer<MediaContextConfig.Builder> consumer) Configure the listener specificMediaContext.mediaContext(Supplier<? extends MediaContext> supplier) Configure the listener specificMediaContext.name()Name of this socket.Name of this socket.intport()Port of the default socket.port(int port) Port of the default socket.protected voidHandles providers and decorators.Configuration of protocols.protocols(List<? extends ProtocolConfig> protocols) Configuration of protocols.booleanService discovery flag forprotocols().protocolsDiscoverServices(boolean protocolsDiscoverServices) Service discovery flag forprotocols().<TYPE> BUILDERputListenerSocketOption(SocketOption<TYPE> key, TYPE listenerSocketOption) Server listener socket options.Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().receiveBufferSize(int receiveBufferSize) Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().Requested URI discovery context.requestedUriDiscoveryContext(RequestedUriDiscoveryContext requestedUriDiscoveryContext) Requested URI discovery context.Requested URI discovery context.requestedUriDiscoveryContext(Supplier<? extends RequestedUriDiscoveryContext> supplier) Requested URI discovery context.booleanCopy and restore response headers before and after passing a request to Jersey for processing.restoreResponseHeaders(boolean restoreResponseHeaders) Copy and restore response headers before and after passing a request to Jersey for processing.routing()Http routing.routing(HttpRouting.Builder routing) Http routing.routing(Consumer<HttpRouting.Builder> builderConsumer) Customize HTTP routing of this listener.routings()List of all routings (possibly for multiple protocols).List of all routings (possibly for multiple protocols).Grace period in ISO 8601 duration format to allow running tasks to complete before listener's shutdown.shutdownGracePeriod(Duration shutdownGracePeriod) Grace period in ISO 8601 duration format to allow running tasks to complete before listener's shutdown.booleanIf enabled andwriteQueueLength()is greater than 1, then start with async writes but possibly switch to sync writes if async queue size is always below a certain threshold.smartAsyncWrites(boolean smartAsyncWrites) If enabled andwriteQueueLength()is greater than 1, then start with async writes but possibly switch to sync writes if async queue size is always below a certain threshold.tls()Listener TLS configuration.Listener TLS configuration.Listener TLS configuration.tls(Consumer<TlsConfig.Builder> consumer) Listener TLS configuration.Listener TLS configuration.toString()booleanuseNio()If set totrue, use NIO socket channel, instead of a socket.useNio(boolean useNio) If set totrue, use NIO socket channel, instead of a socket.protected voidValidates required properties.intInitial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection.writeBufferSize(int writeBufferSize) Initial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection.intNumber of buffers queued for write operations.writeQueueLength(int writeQueueLength) Number of buffers queued for write operations.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.helidon.builder.api.Prototype.Builder
buildPrototype, self
-
Constructor Details
-
BuilderBase
protected BuilderBase()Protected to support extensibility.
-
-
Method Details
-
from
Update this builder from an existing prototype instance. This method disables automatic service discovery.- Parameters:
prototype- existing prototype to update this builder from- Returns:
- updated builder instance
-
from
Update this builder from an existing prototype builder instance.- Parameters:
builder- existing builder prototype to update this builder from- Returns:
- updated builder instance
-
routing
Customize HTTP routing of this listener.- Parameters:
builderConsumer- consumer of HTTP Routing builder- Returns:
- updated builder instance
-
config
Deprecated.Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends ListenerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ListenerConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
config
Update builder from configuration (node of this type). If a value is present in configuration, it would override currently configured values.- Specified by:
configin interfaceConfigBuilderSupport.ConfiguredBuilder<BUILDER extends ListenerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ListenerConfig> - Parameters:
config- configuration instance used to obtain values to update this builder- Returns:
- updated builder instance
-
clearProtocols
Clear all protocols.- Returns:
- updated builder instance
- See Also:
-
protocols
Configuration of protocols. This may be either protocol selectors, or protocol upgraders from HTTP/1.1. As the order is not important (providers are ordered by weight by default), we can use a configuration as an object, such as:protocols: providers: http_1_1: max-prologue-length: 8192 http_2: max-frame-size: 4096 websocket: ....- Parameters:
protocols- all defined protocol configurations, loaded from service loader by default- Returns:
- updated builder instance
- See Also:
-
addProtocols
Configuration of protocols. This may be either protocol selectors, or protocol upgraders from HTTP/1.1. As the order is not important (providers are ordered by weight by default), we can use a configuration as an object, such as:protocols: providers: http_1_1: max-prologue-length: 8192 http_2: max-frame-size: 4096 websocket: ....- Parameters:
protocols- all defined protocol configurations, loaded from service loader by default- Returns:
- updated builder instance
- See Also:
-
addProtocol
Configuration of protocols. This may be either protocol selectors, or protocol upgraders from HTTP/1.1. As the order is not important (providers are ordered by weight by default), we can use a configuration as an object, such as:protocols: providers: http_1_1: max-prologue-length: 8192 http_2: max-frame-size: 4096 websocket: ....- Parameters:
protocol- add single all defined protocol configurations, loaded from service loader by default- Returns:
- updated builder instance
- See Also:
-
clearRouting
Clear existing value of routing.- Returns:
- updated builder instance
- See Also:
-
routing
Http routing. This will always be added to the resultingRouter, if defined, overriding any HTTP routing already present. If a custom listener has routing defined, it will be used, otherwise routing defined on web server will be used.- Parameters:
routing- HTTP Routing for this listener/server- Returns:
- updated builder instance
- See Also:
-
clearRoutings
Clear all routings.- Returns:
- updated builder instance
- See Also:
-
routings
List of all routings (possibly for multiple protocols). This allows adding non-http protocols as well, as opposed torouting()- Parameters:
routings- router for this listener/server- Returns:
- updated builder instance
- See Also:
-
addRoutings
List of all routings (possibly for multiple protocols). This allows adding non-http protocols as well, as opposed torouting()- Parameters:
routings- router for this listener/server- Returns:
- updated builder instance
- See Also:
-
addRouting
List of all routings (possibly for multiple protocols). This allows adding non-http protocols as well, as opposed torouting()- Parameters:
routing- add single router for this listener/server- Returns:
- updated builder instance
- See Also:
-
name
Name of this socket. Defaults to@default. Must be defined if more than one socket is needed.- Parameters:
name- name of the socket- Returns:
- updated builder instance
- See Also:
-
host
Host of the default socket. Defaults to all host addresses (0.0.0.0).- Parameters:
host- host address to listen on (for the default socket)- Returns:
- updated builder instance
- See Also:
-
address
Address to use. If both this andhost()is configured, this will be used.- Parameters:
address- address to use- Returns:
- updated builder instance
- See Also:
-
clearBindAddress
Clear existing value of bindAddress.- Returns:
- updated builder instance
- See Also:
-
bindAddress
The address to bind to. This is to permit both Internet Address (<host>:<port>) and Unix Domain socket (unix:/path/to/socket). If this is set it will overridehost(),address()andport().- Parameters:
bindAddress- the socket address to bind on.- Returns:
- updated builder instance
- See Also:
-
port
Port of the default socket. If configured to0(the default), server starts on a random port.- Parameters:
port- port to listen on (for the default socket)- Returns:
- updated builder instance
- See Also:
-
backlog
Accept backlog.- Parameters:
backlog- backlog- Returns:
- updated builder instance
- See Also:
-
maxPayloadSize
Maximal number of bytes an entity may have. IfHeaderNames.CONTENT_LENGTHis used, this is checked immediately, ifHeaderValues.TRANSFER_ENCODING_CHUNKEDis used, we will fail when the number of bytes read would exceed the max payload size. Defaults to unlimited (-1).- Parameters:
maxPayloadSize- maximal number of bytes of entity- Returns:
- updated builder instance
- See Also:
-
clearReceiveBufferSize
Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().Clear existing value of receiveBufferSize.- Returns:
- updated builder instance
- See Also:
-
receiveBufferSize
Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().Listener receive buffer size.- Parameters:
receiveBufferSize- buffer size in bytes- Returns:
- updated builder instance
- See Also:
-
writeQueueLength
Number of buffers queued for write operations.- Parameters:
writeQueueLength- maximal number of queued writes, defaults to 0- Returns:
- updated builder instance
- See Also:
-
smartAsyncWrites
If enabled andwriteQueueLength()is greater than 1, then start with async writes but possibly switch to sync writes if async queue size is always below a certain threshold.- Parameters:
smartAsyncWrites- smart async setting- Returns:
- updated builder instance
- See Also:
-
writeBufferSize
Initial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection. Default is4096. Set buffer size to a value less than one to turn off buffering.- Parameters:
writeBufferSize- initial buffer size used for writing- Returns:
- updated builder instance
- See Also:
-
shutdownGracePeriod
Grace period in ISO 8601 duration format to allow running tasks to complete before listener's shutdown. Default is500milliseconds.Configuration file values example:
PT0.5S,PT2S.- Parameters:
shutdownGracePeriod- grace period- Returns:
- updated builder instance
- See Also:
-
clearConnectionConfig
Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadClear existing value of connectionConfig.- Returns:
- updated builder instance
- See Also:
-
connectionConfig
@Deprecated(since="4.2.0", forRemoval=true) public BUILDER connectionConfig(ConnectionConfig connectionConfig) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadConfiguration of a connection (established from client against our server).- Parameters:
connectionConfig- connection configuration- Returns:
- updated builder instance
- See Also:
-
connectionConfig
@Deprecated(since="4.2.0", forRemoval=true) public BUILDER connectionConfig(Consumer<ConnectionConfig.Builder> consumer) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadConfiguration of a connection (established from client against our server).- Parameters:
consumer- consumer of builder of connection configuration- Returns:
- updated builder instance
- See Also:
-
connectionConfig
@Deprecated(since="4.2.0", forRemoval=true) public BUILDER connectionConfig(Supplier<? extends ConnectionConfig> supplier) Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadConfiguration of a connection (established from client against our server).- Parameters:
supplier- supplier of connection configuration- Returns:
- updated builder instance
- See Also:
-
clearTls
Clear existing value of tls.- Returns:
- updated builder instance
- See Also:
-
tls
Listener TLS configuration.- Parameters:
tls- tls of this configuration- Returns:
- updated builder instance
- See Also:
-
tls
Listener TLS configuration.- Parameters:
tls- prototype of tls of this configuration- Returns:
- updated builder instance
- See Also:
-
tls
Listener TLS configuration.- Parameters:
consumer- consumer of builder of tls of this configuration- Returns:
- updated builder instance
- See Also:
-
tls
Listener TLS configuration.- Parameters:
supplier- supplier of tls of this configuration- Returns:
- updated builder instance
- See Also:
-
clearContentEncoding
Clear existing value of contentEncoding.- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, content encoding context of the webserver would be used.- Parameters:
contentEncoding- content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, content encoding context of the webserver would be used.- Parameters:
contentEncoding- prototype of content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, content encoding context of the webserver would be used.- Parameters:
consumer- consumer of builder of content encoding context- Returns:
- updated builder instance
- See Also:
-
contentEncoding
Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, content encoding context of the webserver would be used.- Parameters:
supplier- supplier of content encoding context- Returns:
- updated builder instance
- See Also:
-
clearMediaContext
Clear existing value of mediaContext.- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Parameters:
mediaContext- media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Parameters:
mediaContext- prototype of media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Parameters:
consumer- consumer of builder of media context- Returns:
- updated builder instance
- See Also:
-
mediaContext
Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Parameters:
supplier- supplier of media context- Returns:
- updated builder instance
- See Also:
-
connectionOptions
Options for connections accepted by this listener. This is not used to setup server connection.- Parameters:
connectionOptions- socket options- Returns:
- updated builder instance
- See Also:
-
connectionOptions
Options for connections accepted by this listener. This is not used to setup server connection.- Parameters:
consumer- consumer of builder of socket options- Returns:
- updated builder instance
- See Also:
-
connectionOptions
Options for connections accepted by this listener. This is not used to setup server connection.- Parameters:
supplier- supplier of socket options- Returns:
- updated builder instance
- See Also:
-
maxTcpConnections
Limits the number of connections that can be opened at a single point in time. Defaults to-1, meaning "unlimited" - what the system allows.- Parameters:
maxTcpConnections- number of TCP connections that can be opened to this listener, regardless of protocol- Returns:
- updated builder instance
- See Also:
-
maxConcurrentRequests
Limits the number of requests that can be executed at the same time (the number of active virtual threads of requests). Defaults to-1, meaning "unlimited" - what the system allows. Also make sure that this number is higher than the expected time it takes to handle a single request in your application, as otherwise you may stop in-progress requests.Setting this option will always ignore
concurrencyLimit()and will use theFixedLimit.- Parameters:
maxConcurrentRequests- number of requests that can be processed on this listener, regardless of protocol- Returns:
- updated builder instance
- See Also:
-
clearConcurrencyLimit
Clear existing value of concurrencyLimit.- Returns:
- updated builder instance
- See Also:
-
concurrencyLimit
Concurrency limit to use to limit concurrent execution of incoming requests. The default is to have unlimited concurrency.Note that if
maxConcurrentRequests()is configured, this is ignored.- Parameters:
concurrencyLimit- concurrency limit- Returns:
- updated builder instance
- See Also:
-
idleConnectionTimeout
How long should we wait before closing a connection that has no traffic on it. Defaults toPT5M(5 minutes). Note that the timestamp is refreshed max. once per second, so this setting would be useless if configured for shorter periods of time (also not a very good support for connection keep alive, if the connections are killed so soon anyway).- Parameters:
idleConnectionTimeout- timeout of idle connections- Returns:
- updated builder instance
- See Also:
-
idleConnectionPeriod
How often should we check foridleConnectionTimeout(). Defaults toPT2M(2 minutes).- Parameters:
idleConnectionPeriod- period of checking for idle connections- Returns:
- updated builder instance
- See Also:
-
maxInMemoryEntity
If the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance when writing it. If bigger, streaming will be used.Note that for some entity types we cannot use streaming, as they are already fully in memory (String, byte[]), for such cases, this option is ignored.
Default is 128Kb.
- Parameters:
maxInMemoryEntity- maximal number of bytes to buffer in memory for supported writers- Returns:
- updated builder instance
- See Also:
-
listenerSocketOptions
Server listener socket options. Unless configured through builder,SO_REUSEADDRis set totrue, andSO_RCVBUFis set to4096. This method replaces all values with the new ones.- Parameters:
listenerSocketOptions- custom socket options- Returns:
- updated builder instance
- See Also:
-
addListenerSocketOptions
Server listener socket options. Unless configured through builder,SO_REUSEADDRis set totrue, andSO_RCVBUFis set to4096. This method keeps existing values, then puts all new values into the map.- Parameters:
listenerSocketOptions- custom socket options- Returns:
- updated builder instance
- See Also:
-
putListenerSocketOption
Server listener socket options. Unless configured through builder,SO_REUSEADDRis set totrue, andSO_RCVBUFis set to4096. This method adds a new value to the map, or replaces it if the key already exists.- Type Parameters:
TYPE- The key and value has to use the same generic type.- Parameters:
key- key to add or replacelistenerSocketOption- new value for the key- Returns:
- updated builder instance
- See Also:
-
clearConnectionSelectors
Clear all connectionSelectors.- Returns:
- updated builder instance
- See Also:
-
connectionSelectors
Explicitly defined connection selectors to be used with this socket. This list is augmented with the result ofprotocols(), but custom selectors are always used first.- Parameters:
connectionSelectors- connection selectors to be used for this socket- Returns:
- updated builder instance
- See Also:
-
addConnectionSelectors
Explicitly defined connection selectors to be used with this socket. This list is augmented with the result ofprotocols(), but custom selectors are always used first.- Parameters:
connectionSelectors- connection selectors to be used for this socket- Returns:
- updated builder instance
- See Also:
-
addConnectionSelector
Explicitly defined connection selectors to be used with this socket. This list is augmented with the result ofprotocols(), but custom selectors are always used first.- Parameters:
connectionSelector- add single connection selectors to be used for this socket- Returns:
- updated builder instance
- See Also:
-
clearDirectHandlers
Clear existing value of directHandlers.- Returns:
- updated builder instance
- See Also:
-
directHandlers
Direct handlers specific for this listener. A direct handler takes care of problems that happen before (or outside of) routing, such as bad request.- Parameters:
directHandlers- direct handlers- Returns:
- updated builder instance
- See Also:
-
directHandlers
Direct handlers specific for this listener. A direct handler takes care of problems that happen before (or outside of) routing, such as bad request.- Parameters:
consumer- consumer of builder of direct handlers- Returns:
- updated builder instance
- See Also:
-
directHandlers
Direct handlers specific for this listener. A direct handler takes care of problems that happen before (or outside of) routing, such as bad request.- Parameters:
supplier- supplier of direct handlers- Returns:
- updated builder instance
- See Also:
-
clearListenerContext
Clear existing value of listenerContext.- Returns:
- updated builder instance
- See Also:
-
listenerContext
Listener scoped context to be used as a parent for webserver request contexts (if used). If an explicit context is used, you need to take care of correctly configuring its parent. It is expected that the parent of this context is the WebServer context. You should also configure explicit WebServer context when using this method- Parameters:
listenerContext- listener context- Returns:
- updated builder instance
- See Also:
-
listenerContext
Listener scoped context to be used as a parent for webserver request contexts (if used). If an explicit context is used, you need to take care of correctly configuring its parent. It is expected that the parent of this context is the WebServer context. You should also configure explicit WebServer context when using this method- Parameters:
consumer- consumer of builder of listener context- Returns:
- updated builder instance
- See Also:
-
listenerContext
Listener scoped context to be used as a parent for webserver request contexts (if used). If an explicit context is used, you need to take care of correctly configuring its parent. It is expected that the parent of this context is the WebServer context. You should also configure explicit WebServer context when using this method- Parameters:
supplier- supplier of listener context- Returns:
- updated builder instance
- See Also:
-
enableProxyProtocol
Enable proxy protocol support for this socket. This protocol is supported by some load balancers/reverse proxies as a means to convey client information that would otherwise be lost. If enabled, the proxy protocol header must be present on every new connection established with your server. For more information, see the specification. Default isfalse.- Parameters:
enableProxyProtocol- proxy support status- Returns:
- updated builder instance
- See Also:
-
clearRequestedUriDiscoveryContext
Clear existing value of requestedUriDiscoveryContext.- Returns:
- updated builder instance
- See Also:
-
requestedUriDiscoveryContext
public BUILDER requestedUriDiscoveryContext(RequestedUriDiscoveryContext requestedUriDiscoveryContext) Requested URI discovery context.- Parameters:
requestedUriDiscoveryContext- discovery context- Returns:
- updated builder instance
- See Also:
-
requestedUriDiscoveryContext
public BUILDER requestedUriDiscoveryContext(Consumer<RequestedUriDiscoveryContext.Builder> consumer) Requested URI discovery context.- Parameters:
consumer- consumer of builder of discovery context- Returns:
- updated builder instance
- See Also:
-
requestedUriDiscoveryContext
public BUILDER requestedUriDiscoveryContext(Supplier<? extends RequestedUriDiscoveryContext> supplier) Requested URI discovery context.- Parameters:
supplier- supplier of discovery context- Returns:
- updated builder instance
- See Also:
-
errorHandling
Configuration for this listener's error handling.- Parameters:
errorHandling- error handling- Returns:
- updated builder instance
- See Also:
-
errorHandling
Configuration for this listener's error handling.- Parameters:
consumer- consumer of builder of error handling- Returns:
- updated builder instance
- See Also:
-
errorHandling
Configuration for this listener's error handling.- Parameters:
supplier- supplier of error handling- Returns:
- updated builder instance
- See Also:
-
restoreResponseHeaders
Copy and restore response headers before and after passing a request to Jersey for processing. If Jersey fails to handle the request, and the Webserver continues processing the request, it needs to make sure the original headers are restored. Turn off this flag to avoid the extra overhead of copying headers when no handler executes after Jersey returns.- Parameters:
restoreResponseHeaders- copy/restore header setting- Returns:
- updated builder instance
- See Also:
-
ignoreInvalidNamedRouting
If set totrue, any named routing configured that does not have an associated named listener will NOT cause an exception to be thrown (default behavior is to throw an exception).- Parameters:
ignoreInvalidNamedRouting- whether to ignore invalid routing name, defaults tofalse- Returns:
- updated builder instance
- See Also:
-
useNio
If set totrue, use NIO socket channel, instead of a socket. Listener will always be a channel.- Parameters:
useNio- whether to use NIO socket channel, defaults totrue- Returns:
- updated builder instance
- See Also:
-
protocolsDiscoverServices
Service discovery flag forprotocols(). If set totrue, services will be discovered from Java service loader, or Helidon ServiceRegistry.- Parameters:
protocolsDiscoverServices- whether to enable automatic service discovery- Returns:
- updated builder instance
- See Also:
-
concurrencyLimitDiscoverServices
Service discovery flag forconcurrencyLimit(). If set totrue, services will be discovered from Java service loader, or Helidon ServiceRegistry.- Parameters:
concurrencyLimitDiscoverServices- whether to enable automatic service discovery- Returns:
- updated builder instance
- See Also:
-
protocols
Configuration of protocols. This may be either protocol selectors, or protocol upgraders from HTTP/1.1. As the order is not important (providers are ordered by weight by default), we can use a configuration as an object, such as:protocols: providers: http_1_1: max-prologue-length: 8192 http_2: max-frame-size: 4096 websocket: ....- Returns:
- all defined protocol configurations, loaded from service loader by default
-
routing
Http routing. This will always be added to the resultingRouter, if defined, overriding any HTTP routing already present. If a custom listener has routing defined, it will be used, otherwise routing defined on web server will be used.- Returns:
- HTTP Routing for this listener/server
-
routings
List of all routings (possibly for multiple protocols). This allows adding non-http protocols as well, as opposed torouting()- Returns:
- router for this listener/server
-
name
Name of this socket. Defaults to@default. Must be defined if more than one socket is needed.- Returns:
- name of the socket
-
host
Host of the default socket. Defaults to all host addresses (0.0.0.0).- Returns:
- host address to listen on (for the default socket)
-
address
Address to use. If both this andhost()is configured, this will be used.- Returns:
- address to use
-
bindAddress
The address to bind to. This is to permit both Internet Address (<host>:<port>) and Unix Domain socket (unix:/path/to/socket). If this is set it will overridehost(),address()andport().- Returns:
- the socket address to bind on.
-
port
public int port()Port of the default socket. If configured to0(the default), server starts on a random port.- Returns:
- port to listen on (for the default socket)
-
backlog
public int backlog()Accept backlog.- Returns:
- backlog
-
maxPayloadSize
public long maxPayloadSize()Maximal number of bytes an entity may have. IfHeaderNames.CONTENT_LENGTHis used, this is checked immediately, ifHeaderValues.TRANSFER_ENCODING_CHUNKEDis used, we will fail when the number of bytes read would exceed the max payload size. Defaults to unlimited (-1).- Returns:
- maximal number of bytes of entity
-
receiveBufferSize
Deprecated, for removal: This API element is subject to removal in a future version.useSocketOptions.socketReceiveBufferSize()instead viaconnectionOptions().Listener receive buffer size.- Returns:
- buffer size in bytes
-
writeQueueLength
public int writeQueueLength()Number of buffers queued for write operations.- Returns:
- maximal number of queued writes, defaults to 0
-
smartAsyncWrites
public boolean smartAsyncWrites()If enabled andwriteQueueLength()is greater than 1, then start with async writes but possibly switch to sync writes if async queue size is always below a certain threshold.- Returns:
- smart async setting
-
writeBufferSize
public int writeBufferSize()Initial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection. Default is4096. Set buffer size to a value less than one to turn off buffering.- Returns:
- initial buffer size used for writing
-
shutdownGracePeriod
Grace period in ISO 8601 duration format to allow running tasks to complete before listener's shutdown. Default is500milliseconds.Configuration file values example:
PT0.5S,PT2S.- Returns:
- grace period
-
connectionConfig
Deprecated, for removal: This API element is subject to removal in a future version.useconnectionOptions()insteadConfiguration of a connection (established from client against our server).- Returns:
- connection configuration
-
tls
Listener TLS configuration.- Returns:
- tls of this configuration
-
contentEncoding
Configure the listener specificContentEncodingContext. This method discards all previously registered ContentEncodingContext. If no content encoding context is registered, content encoding context of the webserver would be used.- Returns:
- content encoding context
-
mediaContext
Configure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Returns:
- media context
-
connectionOptions
Options for connections accepted by this listener. This is not used to setup server connection.- Returns:
- socket options
-
maxTcpConnections
public int maxTcpConnections()Limits the number of connections that can be opened at a single point in time. Defaults to-1, meaning "unlimited" - what the system allows.- Returns:
- number of TCP connections that can be opened to this listener, regardless of protocol
-
maxConcurrentRequests
public int maxConcurrentRequests()Limits the number of requests that can be executed at the same time (the number of active virtual threads of requests). Defaults to-1, meaning "unlimited" - what the system allows. Also make sure that this number is higher than the expected time it takes to handle a single request in your application, as otherwise you may stop in-progress requests.Setting this option will always ignore
concurrencyLimit()and will use theFixedLimit.- Returns:
- number of requests that can be processed on this listener, regardless of protocol
-
concurrencyLimit
Concurrency limit to use to limit concurrent execution of incoming requests. The default is to have unlimited concurrency.Note that if
maxConcurrentRequests()is configured, this is ignored.- Returns:
- concurrency limit
-
idleConnectionTimeout
How long should we wait before closing a connection that has no traffic on it. Defaults toPT5M(5 minutes). Note that the timestamp is refreshed max. once per second, so this setting would be useless if configured for shorter periods of time (also not a very good support for connection keep alive, if the connections are killed so soon anyway).- Returns:
- timeout of idle connections
-
idleConnectionPeriod
How often should we check foridleConnectionTimeout(). Defaults toPT2M(2 minutes).- Returns:
- period of checking for idle connections
-
maxInMemoryEntity
public int maxInMemoryEntity()If the entity is expected to be smaller that this number of bytes, it would be buffered in memory to optimize performance when writing it. If bigger, streaming will be used.Note that for some entity types we cannot use streaming, as they are already fully in memory (String, byte[]), for such cases, this option is ignored.
Default is 128Kb.
- Returns:
- maximal number of bytes to buffer in memory for supported writers
-
listenerSocketOptions
Server listener socket options. Unless configured through builder,SO_REUSEADDRis set totrue, andSO_RCVBUFis set to4096.- Returns:
- custom socket options
-
connectionSelectors
Explicitly defined connection selectors to be used with this socket. This list is augmented with the result ofprotocols(), but custom selectors are always used first.- Returns:
- connection selectors to be used for this socket
-
directHandlers
Direct handlers specific for this listener. A direct handler takes care of problems that happen before (or outside of) routing, such as bad request.- Returns:
- direct handlers
-
listenerContext
Listener scoped context to be used as a parent for webserver request contexts (if used). If an explicit context is used, you need to take care of correctly configuring its parent. It is expected that the parent of this context is the WebServer context. You should also configure explicit WebServer context when using this method- Returns:
- listener context
- See Also:
-
enableProxyProtocol
public boolean enableProxyProtocol()Enable proxy protocol support for this socket. This protocol is supported by some load balancers/reverse proxies as a means to convey client information that would otherwise be lost. If enabled, the proxy protocol header must be present on every new connection established with your server. For more information, see the specification. Default isfalse.- Returns:
- proxy support status
-
requestedUriDiscoveryContext
Requested URI discovery context.- Returns:
- discovery context
-
errorHandling
Configuration for this listener's error handling.- Returns:
- error handling
-
restoreResponseHeaders
public boolean restoreResponseHeaders()Copy and restore response headers before and after passing a request to Jersey for processing. If Jersey fails to handle the request, and the Webserver continues processing the request, it needs to make sure the original headers are restored. Turn off this flag to avoid the extra overhead of copying headers when no handler executes after Jersey returns.- Returns:
- copy/restore header setting
-
ignoreInvalidNamedRouting
public boolean ignoreInvalidNamedRouting()If set totrue, any named routing configured that does not have an associated named listener will NOT cause an exception to be thrown (default behavior is to throw an exception).- Returns:
- whether to ignore invalid routing name, defaults to
false
-
useNio
public boolean useNio()If set totrue, use NIO socket channel, instead of a socket. Listener will always be a channel.- Returns:
- whether to use NIO socket channel, defaults to
true
-
protocolsDiscoverServices
public boolean protocolsDiscoverServices()Service discovery flag forprotocols(). If set totrue, services will be discovered from Java service loader, or Helidon ServiceRegistry.- Returns:
- whether to enable automatic service discovery
-
concurrencyLimitDiscoverServices
public boolean concurrencyLimitDiscoverServices()Service discovery flag forconcurrencyLimit(). If set totrue, services will be discovered from Java service loader, or Helidon ServiceRegistry.- Returns:
- whether to enable automatic service discovery
-
toString
-
preBuildPrototype
protected void preBuildPrototype()Handles providers and decorators. -
validatePrototype
protected void validatePrototype()Validates required properties. -
config
Configuration used to configure this instance.- Returns:
- config instance
-
connectionOptions()instead