Package com.jsgalactic.axiom.application
Class ManagementOptions.Builder
java.lang.Object
com.jsgalactic.axiom.application.ManagementOptions.Builder
- Enclosing class:
ManagementOptions
Collects settings before
build(). Each setter validates its value at once. Not
thread-safe; the built options are immutable.-
Method Summary
Modifier and TypeMethodDescriptionallowWildcardBind(boolean allowed) Explicitly permits a wildcard management bind.build()Builds immutable options.Sets the bind host.maxRequestBody(int bytes) Caps the request body the management listener accepts.maxResponseBytes(int bytes) Caps the text the metrics scrape returns, so a third-party metrics implementation cannot make an opaque endpoint unbounded.port(int port) Sets the bind port.tls(boolean enabled) Serves HTTPS instead of HTTP, reusing the TLS material of the first application listener.tls(TlsOptions options) Serves HTTPS with a certificate distinct from the application listener's.
-
Method Details
-
host
Sets the bind host. A wildcard address such as0.0.0.0or::is refused at startup unlessallowWildcardBind(boolean)is also set. The default is "127.0.0.1".- Parameters:
host- host name or numeric address- Returns:
- this builder
-
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
Serves HTTPS instead of HTTP, reusing the TLS material of the first application listener. The application listener must itself have TLS configured unlesstls(TlsOptions)also supplies a certificate. Off by default.- Parameters:
enabled- true to reuse the application listener's TLS material- Returns:
- this builder
-
tls
Serves HTTPS with a certificate distinct from the application listener's. Setting a certificate also enables TLS, so callingtls(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
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 permit0.0.0.0and::- Returns:
- this builder
-
maxRequestBody
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
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
Builds immutable options.- Returns:
- the options
-