Module io.helidon.nima.webserver
Package io.helidon.nima.webserver
Class ListenerConfiguration.Builder
java.lang.Object
io.helidon.nima.webserver.ListenerConfiguration.Builder
- All Implemented Interfaces:
Builder<ListenerConfiguration.Builder,,ListenerConfiguration> Supplier<ListenerConfiguration>
- Enclosing class:
ListenerConfiguration
public static class ListenerConfiguration.Builder
extends Object
implements Builder<ListenerConfiguration.Builder,ListenerConfiguration>
Fluent API builder for
ListenerConfiguration.-
Method Summary
Modifier and TypeMethodDescriptionbacklog(int backlog) Accept backlog.bindAddress(InetAddress address) Address to bind to.build()Build the instance from this builder.connectionOptions(Consumer<SocketOptions.Builder> builderConsumer) Configure connection options for connections accepted by this listener.contentEncodingContext(ContentEncodingContext contentEncodingContext) Configure the listener specificContentEncodingContext.Configure listener scoped context to be used as a parent for webserver request contexts.directHandler(DirectHandler handler, DirectHandler.EventType... eventTypes) Configure a simple handler specific for this listener.Host or IP address to bind to.maxPayloadSize(long maxPayloadSize) Maximal number of bytes an entity may have.mediaContext(MediaContext mediaContext) Configure the listener specificMediaContext.port(int port) Port to bind to.receiveBufferSize(int receiveBufferSize) Listener receive buffer size.requestedUriDiscovery(RequestedUriDiscoveryContext discoveryContext) Configure the requested URI discovery context for this listener.Listener TLS configuration.writeBufferSize(int writeBufferSize) Initial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection.writeQueueLength(int writeQueueLength) Number of buffers queued for write operations.
-
Method Details
-
build
Description copied from interface:BuilderBuild the instance from this builder.- Specified by:
buildin interfaceBuilder<ListenerConfiguration.Builder,ListenerConfiguration> - Returns:
- instance of the built type
-
port
Port to bind to.- Parameters:
port- port- Returns:
- updated builder
-
host
Host or IP address to bind to.- Parameters:
host- host- Returns:
- updated builder
-
bindAddress
Address to bind to.- Parameters:
address- address- Returns:
- updated builder
-
backlog
Accept backlog.- Parameters:
backlog- backlog- Returns:
- updated builder
-
receiveBufferSize
Listener receive buffer size.- Parameters:
receiveBufferSize- buffer size in bytes- Returns:
- updated builder
-
tls
Listener TLS configuration.- Parameters:
tls- tls- Returns:
- updated builder
-
connectionOptions
public ListenerConfiguration.Builder connectionOptions(Consumer<SocketOptions.Builder> builderConsumer) Configure connection options for connections accepted by this listener.- Parameters:
builderConsumer- consumer of socket options builder- Returns:
- updated builder
-
writeQueueLength
Number of buffers queued for write operations.- Parameters:
writeQueueLength- maximal number of queued writes, defaults to 0- Returns:
- updated builder
-
writeBufferSize
Initial buffer size in bytes ofBufferedOutputStreamcreated internally to write data to a socket connection. Default is512.- Parameters:
writeBufferSize- initial buffer size used for writing- Returns:
- updated builder
-
maxPayloadSize
Maximal number of bytes an entity may have. IfHttp.Header.CONTENT_LENGTHis used, this is checked immediately, ifHttp.HeaderValues.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
-
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 instance of the builder
-
contentEncodingContext
public ListenerConfiguration.Builder contentEncodingContext(ContentEncodingContext contentEncodingContext) 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:
contentEncodingContext- content encoding context- Returns:
- updated instance of the builder
-
directHandler
public ListenerConfiguration.Builder directHandler(DirectHandler handler, DirectHandler.EventType... eventTypes) Configure a simple handler specific for this listener.- Parameters:
handler- handler to useeventTypes- event types this handler should handle- Returns:
- updated builder
-
context
Configure listener scoped context to be used as a parent for webserver request contexts. 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:
context- top level context- Returns:
- an updated builder
- See Also:
-
requestedUriDiscovery
public ListenerConfiguration.Builder requestedUriDiscovery(RequestedUriDiscoveryContext discoveryContext) Configure the requested URI discovery context for this listener.- Parameters:
discoveryContext- the discovery context- Returns:
- an updated builder
-