Class WebServiceClient.Builder
java.lang.Object
com.maxmind.geoip2.WebServiceClient.Builder
- Enclosing class:
WebServiceClient
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()connectTimeout(Duration val) Disables HTTPS to connect to a test server or proxy.httpClient(HttpClient val) port(int val) proxy(ProxySelector val) requestTimeout(Duration val)
-
Constructor Details
-
Builder
- Parameters:
accountId- Your MaxMind account ID.licenseKey- Your MaxMind license key.
-
-
Method Details
-
connectTimeout
- Parameters:
val- Timeout duration to establish a connection to the web service. The default is 3 seconds.- Returns:
- Builder object
-
disableHttps
Disables HTTPS to connect to a test server or proxy. The minFraud ScoreResponse and InsightsResponse web services require HTTPS.- Returns:
- Builder object
-
host
- Parameters:
val- The host to use. Set this togeolite.infoto use the GeoLite2 web services instead of the GeoIP2 web services. Set this tosandbox.maxmind.comto 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
- Parameters:
val- The port to use.- Returns:
- Builder object
-
locales
- Parameters:
val- List of locale codes to use in name property from most preferred to least preferred.- Returns:
- Builder object
-
requestTimeout
- Parameters:
val- Request timeout duration. The default is 20 seconds.- Returns:
- Builder object
-
proxy
- Parameters:
val- the proxy to use when making this request.- Returns:
- Builder object
-
httpClient
- Parameters:
val- the custom HttpClient to use for requests. When providing a custom HttpClient, you cannot also set connectTimeout or proxy parameters as these should be configured on the provided client.- Returns:
- Builder object
-
build
- Returns:
- an instance of
WebServiceClientcreated from the fields set on this builder. - Throws:
IllegalArgumentException- if httpClient is provided along with connectTimeout or proxy settings
-