https://github.com/yegorkozlov/maxmind-aem
Sample Integration of MaxMind GeoIP2 Database in AEM
https://github.com/yegorkozlov/maxmind-aem
adobe-experience-manager aem geoip2 java maxmind maxmind-geoip osgi
Last synced: about 1 month ago
JSON representation
Sample Integration of MaxMind GeoIP2 Database in AEM
- Host: GitHub
- URL: https://github.com/yegorkozlov/maxmind-aem
- Owner: YegorKozlov
- License: apache-2.0
- Created: 2022-07-24T14:13:44.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-07-24T14:39:36.000Z (almost 3 years ago)
- Last Synced: 2025-02-01T18:45:05.868Z (3 months ago)
- Topics: adobe-experience-manager, aem, geoip2, java, maxmind, maxmind-geoip, osgi
- Language: Java
- Homepage:
- Size: 19.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AEM MaxMind Integration
The AEM [Maxmind](https://www.maxmind.com/) integration allows retrieving geolocation information using the MaxMind GeoIP2 or GeoLite2 databases.
You can download the free MaxMind GeoLite2 City and ASN databases directly from MaxMind at [https://dev.maxmind.com/geoip/geoip2/geolite2/](https://dev.maxmind.com/geoip/geoip2/geolite2/)
## Installation Instructions
Upload the MaxMind GeoIP2 or GeoLite2 database in DAM, e.g. at `/content/dam/maxmind/GeoLite2-City.mmdb`
### Configuration
AEM MaxMind Integration requires an OSGi configuration before it gets active.
To enable it create a configuration for PID `com.ykozlov.aem.maxmind.impl.GeoIPServiceImpl`, e.g.
```text
/apps/my-app/config/com.ykozlov.aem.maxmind.impl.GeoIPServiceImpl
```
and set the `dbPath` property to point to the GeoIP2 database in DAM:
```xml```
## Usage
### Postal Code by IP
```java
GeoIPService geoService = sling.getService(GeoIPService.class);
InetAddress ipAddress = InetAddress.getByName("128.101.101.101");
String postalCode = geoService.getPostalCode(ipAddress);```
## How to build
To build all the modules run in the project root directory the following command with Maven 3:
mvn clean install
To build all the modules and deploy the `all` package to a local instance of AEM, run in the project root directory the following command:
mvn clean install -PautoInstallPackage