reviewhas.blogg.se

Maxmind geoip2
Maxmind geoip2














If the lookup succeeds, the method call will return a response class for the Method will be slightly faster as they do not need to construct and throwĪn exception. If youĪre looking up many IPs that are not contained in the database, the try The method without the prefix will throw anĪddressNotFoundException if the address is not in the database. Prefix return an Optional object, which will be empty if the value is

maxmind geoip2

Methods take the IP address to be looked up. You may also specify theįileMode and the locales fallback order using the methods on the BuilderĪfter you have created the DatabaseReader, you may then call one of theĪppropriate methods, e.g., city or tr圜ity, for your database. InputStream or File for your GeoIP2 database. You must provide the Builder constructor either an To use the database API, you must create a new DatabaseReader using theĭatabaseReader.Builder. new WebServiceClient.Builder(42, "license_key").host("").build() try ( WebServiceClient client = new WebServiceClient. To use the GeoLite2 web service instead of GeoIP2 Precision, call the // host method on the builder with "", e.g.

#MAXMIND GEOIP2 LICENSE#

// Replace "42" with your account ID and "license_key" with your license key. The object is closeable, but // it should not be closed until you are finished making requests with it. Reusing the object will allow it to keep // connections alive for future requests. This creates a WebServiceClient object that is thread-safe and can be // reused across requests. See the API documentation for more details. Resources are promptly returned to the system. Should close the object to ensure the connections are closed and any Once you have finished making requests, you Making multiple requests, the object should be reused so that new connectionsĪre not created for each request. The WebServiceClient object is safe to share across threads. If the request fails, the client class throws an exception. Which represents part of the data returned by the web service. This model in turn contains multiple record classes, each of If the request succeeds, the method call will return a model class for the end The method corresponding to a specific end point, passing it the IP address After you have created the WebServiceClient, you may then call Set a timeout or set the locales fallback order using the methods on theīuilder. Of GeoIP2, set the host method on the builder to.

maxmind geoip2

You must provide the Builder constructor your To use the web service API, you must create a new WebServiceClient using the Should not be used to identify a particular address or household. Any location provided by a GeoIP2 database or web service If you are unable to use Maven or Gradle, you may include the geoip2.jarįile and its dependencies in your classpath.














Maxmind geoip2