Class ManagementOptions.Builder

java.lang.Object
com.jsgalactic.axiom.application.ManagementOptions.Builder
Enclosing class:
ManagementOptions

public static final class ManagementOptions.Builder extends Object
Collects settings before build(). Each setter validates its value at once. Not thread-safe; the built options are immutable.
  • Method Details

    • host

      public ManagementOptions.Builder host(String host)
      Sets the bind host. A wildcard address such as 0.0.0.0 or :: is refused at startup unless allowWildcardBind(boolean) is also set. The default is "127.0.0.1".
      Parameters:
      host - host name or numeric address
      Returns:
      this builder
    • port

      public ManagementOptions.Builder port(int port)
      Sets the bind port.
      Parameters:
      port - zero to allocate a port, or 1 to 65535
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the port is out of range
    • tls

      public ManagementOptions.Builder tls(boolean enabled)
      Serves HTTPS instead of HTTP, reusing the TLS material of the first application listener. The application listener must itself have TLS configured unless tls(TlsOptions) also supplies a certificate. Off by default.
      Parameters:
      enabled - true to reuse the application listener's TLS material
      Returns:
      this builder
    • tls

      public ManagementOptions.Builder tls(TlsOptions options)
      Serves HTTPS with a certificate distinct from the application listener's. Setting a certificate also enables TLS, so calling tls(boolean) is unnecessary; when both are set, these options win. The material is validated when the management listener starts.
      Parameters:
      options - the management listener's TLS settings; null clears an earlier value
      Returns:
      this builder
    • allowWildcardBind

      public ManagementOptions.Builder allowWildcardBind(boolean allowed)
      Explicitly permits a wildcard management bind. Off by default: a wildcard exposes diagnostics on every interface of the host, including public ones.
      Parameters:
      allowed - true to permit 0.0.0.0 and ::
      Returns:
      this builder
    • maxRequestBody

      public ManagementOptions.Builder maxRequestBody(int bytes)
      Caps the request body the management listener accepts. Diagnostics are GET requests; a larger body is answered 413. The default is 65536 bytes.
      Parameters:
      bytes - zero to 65536
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if out of range
    • maxResponseBytes

      public ManagementOptions.Builder maxResponseBytes(int bytes)
      Caps the text the metrics scrape returns, so a third-party metrics implementation cannot make an opaque endpoint unbounded. The default is 65536 bytes.
      Parameters:
      bytes - 1 to 65536
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if out of range
    • build

      public ManagementOptions build()
      Builds immutable options.
      Returns:
      the options