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 Details

    • build

      public ListenerConfiguration build()
      Description copied from interface: Builder
      Build the instance from this builder.
      Specified by:
      build in interface Builder<ListenerConfiguration.Builder,ListenerConfiguration>
      Returns:
      instance of the built type
    • port

      public ListenerConfiguration.Builder port(int 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

      public ListenerConfiguration.Builder bindAddress(InetAddress address)
      Address to bind to.
      Parameters:
      address - address
      Returns:
      updated builder
    • backlog

      public ListenerConfiguration.Builder backlog(int backlog)
      Accept backlog.
      Parameters:
      backlog - backlog
      Returns:
      updated builder
    • receiveBufferSize

      public ListenerConfiguration.Builder receiveBufferSize(int 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

      public ListenerConfiguration.Builder writeQueueLength(int writeQueueLength)
      Number of buffers queued for write operations.
      Parameters:
      writeQueueLength - maximal number of queued writes, defaults to 0
      Returns:
      updated builder
    • writeBufferSize

      public ListenerConfiguration.Builder writeBufferSize(int writeBufferSize)
      Initial buffer size in bytes of BufferedOutputStream created internally to write data to a socket connection. Default is 512.
      Parameters:
      writeBufferSize - initial buffer size used for writing
      Returns:
      updated builder
    • maxPayloadSize

      public ListenerConfiguration.Builder maxPayloadSize(long maxPayloadSize)
      Maximal number of bytes an entity may have. If Http.Header.CONTENT_LENGTH is used, this is checked immediately, if Http.HeaderValues.TRANSFER_ENCODING_CHUNKED is 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

      public ListenerConfiguration.Builder mediaContext(MediaContext mediaContext)
      Configure the listener specific MediaContext. 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 specific ContentEncodingContext. 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 use
      eventTypes - event types this handler should handle
      Returns:
      updated builder
    • context

      public ListenerConfiguration.Builder context(Context 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