Class HttpConfig.Builder

java.lang.Object
com.vonage.client.HttpConfig.Builder
Enclosing class:
HttpConfig

public static class HttpConfig.Builder extends Object
Builder for configuring the base URI and timeout of the client.
  • Constructor Details

    • Builder

      Deprecated.
      Will be made private in the next major version.
      Constructor.
  • Method Details

    • timeoutMillis

      public HttpConfig.Builder timeoutMillis(int timeoutMillis)
      Sets the socket timeout for requests. By default, this is one minute (60000 ms).
      Note that this timeout applies to both the connection and socket; therefore, it defines the maximum time for each stage of the request. For example, if set to 30 seconds, then establishing a connection may take 29 seconds and receiving a response may take 29 seconds without timing out (therefore a total of 58 seconds for the request).
      Parameters:
      timeoutMillis - The timeout in milliseconds.
      Returns:
      This builder.
      Since:
      7.8.0
    • proxy

      Sets the proxy to use for requests. This will route requests through the specified URL.
      Parameters:
      proxy - The proxy URI to use as a string.
      Returns:
      This builder.
      Throws:
      IllegalArgumentException - If the proxy URI is invalid.
      Since:
      8.15.0
    • proxy

      public HttpConfig.Builder proxy(URI proxy)
      Sets the proxy to use for requests. This will route requests through the specified URL.
      Parameters:
      proxy - The proxy URI to use.
      Returns:
      This builder.
      Since:
      8.15.0
    • apiBaseUri

      public HttpConfig.Builder apiBaseUri(String apiBaseUri)
      Replaces the URI used in "api" endpoints.
      Parameters:
      apiBaseUri - The base uri to use.
      Returns:
      This builder.
    • restBaseUri

      public HttpConfig.Builder restBaseUri(String restBaseUri)
      Replaces the base URI used in "rest" endpoints.
      Parameters:
      restBaseUri - The base uri to use.
      Returns:
      This builder.
    • apiEuBaseUri

      public HttpConfig.Builder apiEuBaseUri(String apiEuBaseUri)
      Replaces the base URI used in "api-eu" endpoints.
      Parameters:
      apiEuBaseUri - The base URI to use.
      Returns:
      This builder.
    • videoBaseUri

      public HttpConfig.Builder videoBaseUri(String videoBaseUri)
      Replaces the base URI used in "video" endpoints.
      Parameters:
      videoBaseUri - The base URI to use.
      Returns:
      This builder.
      Since:
      8.0.0
    • baseUri

      public HttpConfig.Builder baseUri(String baseUri)
      Replaces the base URI used in all requests with the specified parameter.
      Parameters:
      baseUri - The base URI to use.
      Returns:
      This builder.
    • baseUri

      public HttpConfig.Builder baseUri(URI baseUri)
      Replaces the base URI used in all requests with the specified parameter.
      Parameters:
      baseUri - The base URI to use.
      Returns:
      This builder.
      Since:
      8.9.0
    • regionalUriGetter

      Sets a function to get the base URI for a given region.
      Parameters:
      uriGetter - The function which takes as input a region and returns a base URI as a string.
      Returns:
      This builder.
      Since:
      8.11.0
    • appendUserAgent

      Appends a custom string to the default User-Agent header. This is mainly used for derivatives of the SDK, or to distinguish particular users / use cases.
      Parameters:
      userAgent - The user agent string to append to the existing one. Must be less than 128 characters.
      Returns:
      This builder.
      Since:
      8.11.0
    • build

      public HttpConfig build()
      Builds the HttpConfig.
      Returns:
      A new HttpConfig object from the stored builder options.