Class ManagementOptions

java.lang.Object
com.jsgalactic.axiom.application.ManagementOptions

public final class ManagementOptions extends Object
Opt-in settings for a separate management listener, passed to Application.management(ManagementOptions). Nothing is bound until the application's first Application.listen(java.net.InetSocketAddress), and an application without these settings keeps a single listener.

The listener serves only health probes and a metrics scrape. It never runs application routes, middleware or user handlers. The defaults bind the loopback address, refuse a wildcard bind, use plain HTTP and bound both request bodies and response text. HTTPS can reuse the application listener's certificate or use one configured only for management. Instances are immutable.

  • Field Details

    • DEFAULT_HOST

      public static final String DEFAULT_HOST
      Loopback host used when none is set.
      See Also:
    • METRICS_PATH

      public static final String METRICS_PATH
      Path of the metrics scrape.
      See Also:
    • MAX_BODY_BYTES

      public static final int MAX_BODY_BYTES
      Largest request body the management listener accepts.
      See Also:
    • MAX_RESPONSE_BYTES

      public static final int MAX_RESPONSE_BYTES
      Largest response body the management listener produces.
      See Also:
    • MAX_HEALTH

      public static final int MAX_HEALTH
      Most Health instances a management listener uses.
      See Also:
  • Method Details

    • of

      public static ManagementOptions of(int port)
      Options for a loopback listener on the given port with every other setting at its default.
      Parameters:
      port - port, or zero for an allocated port
      Returns:
      the options
      Throws:
      IllegalArgumentException - if the port is out of range
    • builder

      public static ManagementOptions.Builder builder()
      Starts a builder with the default host, an ephemeral port and bounded diagnostics.
      Returns:
      a new builder
    • toBuilder

      public ManagementOptions.Builder toBuilder()
      Starts a builder holding these options' values.
      Returns:
      a new builder
    • host

      public String host()
      Returns:
      host name or address to bind, "127.0.0.1" by default
    • port

      public int port()
      Returns:
      port to bind, or zero for an allocated port
    • tls

      public boolean tls()
      Returns:
      whether the listener reuses the first application listener's TLS material
    • tlsOptions

      public Optional<TlsOptions> tlsOptions()
      Returns an explicit certificate for the management listener, when one was set. It replaces the application listener's material even when tls() is also set.
      Returns:
      the management listener's own TLS settings, or empty to reuse the application's
    • allowWildcardBind

      public boolean allowWildcardBind()
      Returns:
      whether a wildcard bind address is accepted
    • maxRequestBody

      public int maxRequestBody()
      Returns:
      largest accepted request body in bytes
    • maxResponseBytes

      public int maxResponseBytes()
      Returns:
      largest produced response body in bytes
    • toString

      public String toString()
      Describes the options without claiming a bound address.
      Overrides:
      toString in class Object