java.lang.Object
com.hedera.hashgraph.sdk.MirrorNodeHttpConfig
Everything a
Client holds for mirror node REST access, in one value.
One type rather than a setter per knob, because Client is already the most overloaded
class in the SDK. Four rules make the collapse safe:
getTransport()carries provenance. Null means the SDK builds the transport and owns it; non-null means the application supplied it and owns it, andClient.close()will never close it.Client.getMirrorNodeHttpConfig()returns the configuration as supplied, never as resolved. Inspecting aClientnever constructs a transport, andsetMirrorNodeHttpConfig(getMirrorNodeHttpConfig())is a true no-op rather than a statement of ownership.- Setting replaces; it does not merge. The getter never returns null, so
set(get().withX(...))is the idiom. getTransportConfiguration()is ignored when a transport is injected. It configures the transport the SDK would have built.
-
Method Summary
Modifier and TypeMethodDescriptionstatic MirrorNodeHttpConfigdefaults()A configuration with every field at its declared default and no injected transport.Extract the caller headers.Extract the retry policy.@Nullable HttpTransportExtract the application-supplied transport.Extract how the SDK-supplied transport is built.toString()withRequestHeader(String name, String value) Derive a copy carrying one more caller header.withRequestHeaders(Map<String, String> requestHeaders) Derive a copy whose caller headers are replaced wholesale.withRetryPolicy(MirrorNodeHttpRetryPolicy retryPolicy) Derive a copy with a different retry policy.withTransport(@Nullable HttpTransport transport) Derive a copy that uses an application-supplied transport.withTransportConfiguration(HttpTransportConfiguration transportConfiguration) Derive a copy that builds the SDK's own transport differently.
-
Method Details
-
defaults
A configuration with every field at its declared default and no injected transport.- Returns:
- the default configuration
-
withTransport
Derive a copy that uses an application-supplied transport.This is the single extension point for Android, corporate proxies, mTLS, tracing wrappers and test fakes. It must be installed before the first mirror node REST call, because the transport is built once per
Client. An injected transport is never closed by the SDK.- Parameters:
transport- the transport to use, or null to let the SDK build and own one- Returns:
- the derived configuration
-
withTransportConfiguration
public MirrorNodeHttpConfig withTransportConfiguration(HttpTransportConfiguration transportConfiguration) Derive a copy that builds the SDK's own transport differently.Ignored when a transport is injected.
- Parameters:
transportConfiguration- how to build the SDK-supplied transport- Returns:
- the derived configuration
-
withRetryPolicy
Derive a copy with a different retry policy.- Parameters:
retryPolicy- the budget for every mirror node REST call made through this client- Returns:
- the derived configuration
-
withRequestHeader
Derive a copy carrying one more caller header.- Parameters:
name- the header name;user-agentandx-user-agentare reserved and rejected case-insensitively, because the SDK owns that headervalue- the header value- Returns:
- the derived configuration
-
withRequestHeaders
Derive a copy whose caller headers are replaced wholesale.- Parameters:
requestHeaders- the headers to send on every mirror node REST request; names are lowercased, anduser-agentandx-user-agentare rejected- Returns:
- the derived configuration
-
getTransport
Extract the application-supplied transport.- Returns:
- the injected transport, or null when the SDK builds and owns one
-
getTransportConfiguration
Extract how the SDK-supplied transport is built.- Returns:
- the transport configuration; ignored when a transport is injected
-
getRetryPolicy
Extract the retry policy.- Returns:
- the policy
-
getRequestHeaders
Extract the caller headers.- Returns:
- an unmodifiable map with lowercased names, never null
-
toString
-