Class MirrorNodeHttpConfig

java.lang.Object
com.hedera.hashgraph.sdk.MirrorNodeHttpConfig

public final class MirrorNodeHttpConfig extends Object
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:

  1. getTransport() carries provenance. Null means the SDK builds the transport and owns it; non-null means the application supplied it and owns it, and Client.close() will never close it.
  2. Client.getMirrorNodeHttpConfig() returns the configuration as supplied, never as resolved. Inspecting a Client never constructs a transport, and setMirrorNodeHttpConfig(getMirrorNodeHttpConfig()) is a true no-op rather than a statement of ownership.
  3. Setting replaces; it does not merge. The getter never returns null, so set(get().withX(...)) is the idiom.
  4. getTransportConfiguration() is ignored when a transport is injected. It configures the transport the SDK would have built.
  • Method Details

    • defaults

      public static MirrorNodeHttpConfig defaults()
      A configuration with every field at its declared default and no injected transport.
      Returns:
      the default configuration
    • withTransport

      public MirrorNodeHttpConfig withTransport(@Nullable HttpTransport transport)
      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

      public MirrorNodeHttpConfig withRetryPolicy(MirrorNodeHttpRetryPolicy retryPolicy)
      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

      public MirrorNodeHttpConfig withRequestHeader(String name, String value)
      Derive a copy carrying one more caller header.
      Parameters:
      name - the header name; user-agent and x-user-agent are reserved and rejected case-insensitively, because the SDK owns that header
      value - the header value
      Returns:
      the derived configuration
    • withRequestHeaders

      public MirrorNodeHttpConfig withRequestHeaders(Map<String,String> requestHeaders)
      Derive a copy whose caller headers are replaced wholesale.
      Parameters:
      requestHeaders - the headers to send on every mirror node REST request; names are lowercased, and user-agent and x-user-agent are rejected
      Returns:
      the derived configuration
    • getTransport

      public @Nullable HttpTransport getTransport()
      Extract the application-supplied transport.
      Returns:
      the injected transport, or null when the SDK builds and owns one
    • getTransportConfiguration

      public HttpTransportConfiguration getTransportConfiguration()
      Extract how the SDK-supplied transport is built.
      Returns:
      the transport configuration; ignored when a transport is injected
    • getRetryPolicy

      public MirrorNodeHttpRetryPolicy getRetryPolicy()
      Extract the retry policy.
      Returns:
      the policy
    • getRequestHeaders

      public Map<String,String> getRequestHeaders()
      Extract the caller headers.
      Returns:
      an unmodifiable map with lowercased names, never null
    • toString

      public String toString()
      Overrides:
      toString in class Object