Grails GeoIp2 plugin based on MaxMind library
Allows you to get location info based on a request, such as country, city, geographical coordinates.
Similar to the Grails GeoIP plugin but uses the GeoLite2 database and the GeoIP2 Java API.
Add the following to your BuildConfig.groovy
:
plugins {
compile ':geoip2:1.0'
}
On installation, this plugin downloads the GeoLite2 database into your app's web-app
folder at web-app\data\maxmind
and appends a config to your app's Config.groovy
.
To update your database, reinstall the plugin by deleting your target
folder and running grails refresh-dependencies
.
import grails.plugins.geoip2.Geoip2Service
class MyController {
Geoip2Service geoip2Service
def getCountryCode() {
render geoip2Service.getCountryCode(request)
}
}
Copyright 2015 Charlotte Tan under the MIT License. Supported by Epic Games.
This product includes GeoLite2 data created by MaxMind, available from MaxMind.com.