Class HttpTransportConfiguration

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

public final class HttpTransportConfiguration extends Object
How the SDK-supplied DefaultHttpTransport is built.

It is ignored when an application injects its own transport through MirrorNodeHttpConfig.withTransport(HttpTransport) — an injected transport brings its own connect timeout, redirect bound and body cap.

Instances are derived from defaults() with the withX methods. There is no public constructor, so a partially populated instance is unreachable.

  • Method Details

    • defaults

      public static HttpTransportConfiguration defaults()
      A configuration with every field at its declared default.
      Returns:
      the default configuration
    • withConnectTimeout

      public HttpTransportConfiguration withConnectTimeout(Duration connectTimeout)
      Derive a copy with a different connect timeout.
      Parameters:
      connectTimeout - the bound on TCP connect and the TLS handshake together; Duration.ZERO keeps the platform stack's own bound rather than meaning "no bound"
      Returns:
      the derived configuration
    • withMaxRedirects

      public HttpTransportConfiguration withMaxRedirects(int maxRedirects)
      Derive a copy with a different redirect bound.
      Parameters:
      maxRedirects - the number of hops to follow; 0 follows none
      Returns:
      the derived configuration
    • withMaxResponseBytes

      public HttpTransportConfiguration withMaxResponseBytes(long maxResponseBytes)
      Derive a copy with a different response body cap.
      Parameters:
      maxResponseBytes - the cap, in bytes; must be at least 1
      Returns:
      the derived configuration
    • withDefaultHeaders

      public HttpTransportConfiguration withDefaultHeaders(Map<String,String> defaultHeaders)
      Derive a copy whose default headers are replaced wholesale.

      These sit at the bottom of the header precedence order: they belong to the SDK-built transport alone, and are overridden by the caller headers on MirrorNodeHttpConfig, by any header the endpoint sets, and by the SDK identity header.

      Parameters:
      defaultHeaders - the headers to send on every request; names are lowercased
      Returns:
      the derived configuration
    • getConnectTimeout

      public Duration getConnectTimeout()
      Extract the connect timeout.
      Returns:
      the bound on connect and handshake; Duration.ZERO means the platform default
    • getMaxRedirects

      public int getMaxRedirects()
      Extract the redirect bound.
      Returns:
      the number of hops to follow
    • getMaxResponseBytes

      public long getMaxResponseBytes()
      Extract the response body cap.
      Returns:
      the cap, in bytes
    • getDefaultHeaders

      public Map<String,String> getDefaultHeaders()
      Extract the transport's default headers.
      Returns:
      an unmodifiable map, never null
    • toString

      public String toString()
      Overrides:
      toString in class Object