Module io.helidon.webserver
Package io.helidon.webserver
Class ListenerConfig.BuilderBase.ListenerConfigImpl
java.lang.Object
io.helidon.webserver.ListenerConfig.BuilderBase.ListenerConfigImpl
- All Implemented Interfaces:
- Prototype.Api,- ListenerConfig
- Direct Known Subclasses:
- WebServerConfig.BuilderBase.WebServerConfigImpl
- Enclosing class:
- ListenerConfig.BuilderBase<BUILDER extends ListenerConfig.BuilderBase<BUILDER,- PROTOTYPE>, - PROTOTYPE extends ListenerConfig> 
protected static class ListenerConfig.BuilderBase.ListenerConfigImpl
extends Object
implements ListenerConfig
Generated implementation of the prototype, can be extended by descendant prototype implementations.
- 
Nested Class SummaryNested classes/interfaces inherited from interface io.helidon.webserver.ListenerConfigListenerConfig.Builder, ListenerConfig.BuilderBase<BUILDER extends ListenerConfig.BuilderBase<BUILDER,PROTOTYPE>, PROTOTYPE extends ListenerConfig> 
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedListenerConfigImpl(ListenerConfig.BuilderBase<?, ?> builder) Create an instance providing a builder.
- 
Method SummaryModifier and TypeMethodDescriptionaddress()Address to use.intbacklog()Accept backlog.Concurrency limit to use to limit concurrent execution of incoming requests.default voidconfigureSocket(ServerSocket socket) Update the server socket with configured socket options.Configuration of a connection (established from client against our server).Options for connections accepted by this listener.Explicitly defined connection selectors to be used with this socket.Configure the listener specificContentEncodingContext.Direct handlers specific for this listener.booleanEnable proxy protocol support for this socket.booleanConfiguration for this listener's error handling.inthashCode()host()Host of the default socket.How often should we check forListenerConfig.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).Listener scoped context to be used as a parent for webserver request contexts (if used).Map<SocketOption<?>, Object> 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).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.longMaximal number of bytes an entity may have.intLimits the number of connections that can be opened at a single point in time.Configure the listener specificMediaContext.name()Name of this socket.intport()Port of the default socket.Configuration of protocols.Listener receive buffer size.Requested URI discovery context.booleanCopy and restore response headers before and after passing a request to Jersey for processing.routing()Http routing.routings()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.booleanIf enabled andListenerConfig.writeQueueLength()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.toString()intInitial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection.intNumber of buffers queued for write operations.
- 
Constructor Details- 
ListenerConfigImplCreate an instance providing a builder.- Parameters:
- builder- extending builder base of this prototype
 
 
- 
- 
Method Details- 
protocolsDescription copied from interface:ListenerConfigConfiguration 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: ....- Specified by:
- protocolsin interface- ListenerConfig
- Returns:
- all defined protocol configurations, loaded from service loader by default
 
- 
routingDescription copied from interface:ListenerConfigHttp 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.- Specified by:
- routingin interface- ListenerConfig
- Returns:
- HTTP Routing for this listener/server
 
- 
routingsDescription copied from interface:ListenerConfigList of all routings (possibly for multiple protocols). This allows adding non-http protocols as well, as opposed toListenerConfig.routing()- Specified by:
- routingsin interface- ListenerConfig
- Returns:
- router for this listener/server
 
- 
nameDescription copied from interface:ListenerConfigName of this socket. Defaults to@default. Must be defined if more than one socket is needed.- Specified by:
- namein interface- ListenerConfig
- Returns:
- name of the socket
 
- 
hostDescription copied from interface:ListenerConfigHost of the default socket. Defaults to all host addresses (0.0.0.0).- Specified by:
- hostin interface- ListenerConfig
- Returns:
- host address to listen on (for the default socket)
 
- 
addressDescription copied from interface:ListenerConfigAddress to use. If both this andListenerConfig.host()is configured, this will be used.- Specified by:
- addressin interface- ListenerConfig
- Returns:
- address to use
 
- 
portpublic int port()Description copied from interface:ListenerConfigPort of the default socket. If configured to0(the default), server starts on a random port.- Specified by:
- portin interface- ListenerConfig
- Returns:
- port to listen on (for the default socket)
 
- 
backlogpublic int backlog()Description copied from interface:ListenerConfigAccept backlog.- Specified by:
- backlogin interface- ListenerConfig
- Returns:
- backlog
 
- 
maxPayloadSizepublic long maxPayloadSize()Description copied from interface:ListenerConfigMaximal 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).- Specified by:
- maxPayloadSizein interface- ListenerConfig
- Returns:
- maximal number of bytes of entity
 
- 
receiveBufferSizeDescription copied from interface:ListenerConfigListener receive buffer size.- Specified by:
- receiveBufferSizein interface- ListenerConfig
- Returns:
- buffer size in bytes
 
- 
writeQueueLengthpublic int writeQueueLength()Description copied from interface:ListenerConfigNumber of buffers queued for write operations.- Specified by:
- writeQueueLengthin interface- ListenerConfig
- Returns:
- maximal number of queued writes, defaults to 0
 
- 
smartAsyncWritespublic boolean smartAsyncWrites()Description copied from interface:ListenerConfigIf enabled andListenerConfig.writeQueueLength()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.- Specified by:
- smartAsyncWritesin interface- ListenerConfig
- Returns:
- smart async setting
 
- 
writeBufferSizepublic int writeBufferSize()Description copied from interface:ListenerConfigInitial 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.- Specified by:
- writeBufferSizein interface- ListenerConfig
- Returns:
- initial buffer size used for writing
 
- 
shutdownGracePeriodDescription copied from interface:ListenerConfigGrace 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.- Specified by:
- shutdownGracePeriodin interface- ListenerConfig
- Returns:
- grace period
 
- 
connectionConfigDescription copied from interface:ListenerConfigConfiguration of a connection (established from client against our server).- Specified by:
- connectionConfigin interface- ListenerConfig
- Returns:
- connection configuration
 
- 
tlsDescription copied from interface:ListenerConfigListener TLS configuration.- Specified by:
- tlsin interface- ListenerConfig
- Returns:
- tls of this configuration
 
- 
contentEncodingDescription copied from interface:ListenerConfigConfigure 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.- Specified by:
- contentEncodingin interface- ListenerConfig
- Returns:
- content encoding context
 
- 
mediaContextDescription copied from interface:ListenerConfigConfigure the listener specificMediaContext. This method discards all previously registered MediaContext. If no media context is registered, media context of the webserver would be used.- Specified by:
- mediaContextin interface- ListenerConfig
- Returns:
- media context
 
- 
connectionOptionsDescription copied from interface:ListenerConfigOptions for connections accepted by this listener. This is not used to setup server connection.- Specified by:
- connectionOptionsin interface- ListenerConfig
- Returns:
- socket options
 
- 
maxTcpConnectionspublic int maxTcpConnections()Description copied from interface:ListenerConfigLimits the number of connections that can be opened at a single point in time. Defaults to-1, meaning "unlimited" - what the system allows.- Specified by:
- maxTcpConnectionsin interface- ListenerConfig
- Returns:
- number of TCP connections that can be opened to this listener, regardless of protocol
 
- 
maxConcurrentRequestspublic int maxConcurrentRequests()Description copied from interface:ListenerConfigLimits 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 ListenerConfig.concurrencyLimit()and will use theFixedLimit.- Specified by:
- maxConcurrentRequestsin interface- ListenerConfig
- Returns:
- number of requests that can be processed on this listener, regardless of protocol
 
- 
concurrencyLimitDescription copied from interface:ListenerConfigConcurrency limit to use to limit concurrent execution of incoming requests. The default is to have unlimited concurrency.Note that if ListenerConfig.maxConcurrentRequests()is configured, this is ignored.- Specified by:
- concurrencyLimitin interface- ListenerConfig
- Returns:
- concurrency limit
 
- 
idleConnectionTimeoutDescription copied from interface:ListenerConfigHow 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).- Specified by:
- idleConnectionTimeoutin interface- ListenerConfig
- Returns:
- timeout of idle connections
 
- 
idleConnectionPeriodDescription copied from interface:ListenerConfigHow often should we check forListenerConfig.idleConnectionTimeout(). Defaults toPT2M(2 minutes).- Specified by:
- idleConnectionPeriodin interface- ListenerConfig
- Returns:
- period of checking for idle connections
 
- 
maxInMemoryEntitypublic int maxInMemoryEntity()Description copied from interface:ListenerConfigIf 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. - Specified by:
- maxInMemoryEntityin interface- ListenerConfig
- Returns:
- maximal number of bytes to buffer in memory for supported writers
 
- 
listenerSocketOptionsDescription copied from interface:ListenerConfigServer listener socket options. Unless configured through builder,SO_REUSEADDRis set totrue, andSO_RCVBUFis set to4096.- Specified by:
- listenerSocketOptionsin interface- ListenerConfig
- Returns:
- custom socket options
 
- 
connectionSelectorsDescription copied from interface:ListenerConfigExplicitly defined connection selectors to be used with this socket. This list is augmented with the result ofListenerConfig.protocols(), but custom selectors are always used first.- Specified by:
- connectionSelectorsin interface- ListenerConfig
- Returns:
- connection selectors to be used for this socket
 
- 
directHandlersDescription copied from interface:ListenerConfigDirect handlers specific for this listener. A direct handler takes care of problems that happen before (or outside of) routing, such as bad request.- Specified by:
- directHandlersin interface- ListenerConfig
- Returns:
- direct handlers
 
- 
listenerContextDescription copied from interface:ListenerConfigListener 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- Specified by:
- listenerContextin interface- ListenerConfig
- Returns:
- listener context
- See Also:
 
- 
enableProxyProtocolpublic boolean enableProxyProtocol()Description copied from interface:ListenerConfigEnable 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.- Specified by:
- enableProxyProtocolin interface- ListenerConfig
- Returns:
- proxy support status
 
- 
requestedUriDiscoveryContextDescription copied from interface:ListenerConfigRequested URI discovery context.- Specified by:
- requestedUriDiscoveryContextin interface- ListenerConfig
- Returns:
- discovery context
 
- 
errorHandlingDescription copied from interface:ListenerConfigConfiguration for this listener's error handling.- Specified by:
- errorHandlingin interface- ListenerConfig
- Returns:
- error handling
 
- 
restoreResponseHeaderspublic boolean restoreResponseHeaders()Description copied from interface:ListenerConfigCopy 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.- Specified by:
- restoreResponseHeadersin interface- ListenerConfig
- Returns:
- copy/restore header setting
 
- 
ignoreInvalidNamedRoutingpublic boolean ignoreInvalidNamedRouting()Description copied from interface:ListenerConfigIf 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).- Specified by:
- ignoreInvalidNamedRoutingin interface- ListenerConfig
- Returns:
- whether to ignore invalid routing name, defaults to false
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
- 
configureSocketUpdate the server socket with configured socket options.- Parameters:
- socket- socket to update
 
 
-