Class WebServiceClient.Builder

java.lang.Object
com.maxmind.geoip2.WebServiceClient.Builder
Enclosing class:
WebServiceClient

public static final class WebServiceClient.Builder extends Object

Builder creates instances of WebServiceClient from values set by the methods.

This example shows how to create a WebServiceClient object with the Builder:

WebServiceClient client = new WebServiceClient.Builder(12,"licensekey") .host("geoip.maxmind.com").build();

Only the values set in the Builder constructor are required.

  • Constructor Details

    • Builder

      public Builder(int accountId, String licenseKey)
      Parameters:
      accountId - Your MaxMind account ID.
      licenseKey - Your MaxMind license key.
  • Method Details

    • connectTimeout

      @Deprecated public WebServiceClient.Builder connectTimeout(int val)
      Deprecated.
      Use connectTimeout(Duration) instead
      Parameters:
      val - Timeout in milliseconds to establish a connection to the web service. The default is 3000 (3 seconds).
      Returns:
      Builder object
    • connectTimeout

      public WebServiceClient.Builder connectTimeout(Duration val)
      Parameters:
      val - Timeout duration to establish a connection to the web service. The default is 3 seconds.
      Returns:
      Builder object
    • disableHttps

      public WebServiceClient.Builder disableHttps()
      Disables HTTPS to connect to a test server or proxy. The minFraud ScoreResponse and InsightsResponse web services require HTTPS.
      Returns:
      Builder object
    • host

      public WebServiceClient.Builder host(String val)
      Parameters:
      val - The host to use. Set this to geolite.info to use the GeoLite2 web services instead of the GeoIP2 web services. Set this to sandbox.maxmind.com to use the Sandbox GeoIP2 web services instead of the production GeoIP2 web services. The sandbox allows you to experiment with the API without affecting your production data.
      Returns:
      Builder object
    • port

      public WebServiceClient.Builder port(int val)
      Parameters:
      val - The port to use.
      Returns:
      Builder object
    • locales

      public WebServiceClient.Builder locales(List<String> val)
      Parameters:
      val - List of locale codes to use in name property from most preferred to least preferred.
      Returns:
      Builder object
    • readTimeout

      @Deprecated public WebServiceClient.Builder readTimeout(int val)
      Deprecated.
      Use requestTimeout(Duration) instead
      Parameters:
      val - readTimeout in milliseconds to read data from an established connection to the web service. The default is 20000 (20 seconds).
      Returns:
      Builder object
    • requestTimeout

      public WebServiceClient.Builder requestTimeout(Duration val)
      Parameters:
      val - Request timeout duration. The default is 20 seconds.
      Returns:
      Builder object
    • proxy

      Deprecated.
      Use proxy(ProxySelector)
      Parameters:
      val - the proxy to use when making this request.
      Returns:
      Builder object
    • proxy

      Parameters:
      val - the proxy to use when making this request.
      Returns:
      Builder object
    • build

      public WebServiceClient build()
      Returns:
      an instance of WebServiceClient created from the fields set on this builder.