|
|
|
@ -51,14 +51,18 @@ public class GeoIpLocator {
|
|
|
|
|
@Override
|
|
|
|
|
public String handleResponse(ClassicHttpResponse result) throws HttpException, IOException {
|
|
|
|
|
String body = new String(result.getEntity().getContent().readAllBytes(), StandardCharsets.UTF_8);
|
|
|
|
|
logger.info("[{}] asyncClient.execute completed, response code: {}, body: {}", remoteIpAddress,
|
|
|
|
|
logger.info("[{}] httpClient.execute completed, response code: {}, body: {}", remoteIpAddress,
|
|
|
|
|
result.getCode(), body);
|
|
|
|
|
ipInfoMapping.put(remoteIpAddress, body);
|
|
|
|
|
int inserted = jdbcService.insertRemoteIpInfo(remoteIpAddress, body);
|
|
|
|
|
ipInfoLogger.info("[{}] {}, inserted = {}", remoteIpAddress, ipInfoMapping.get(remoteIpAddress),
|
|
|
|
|
inserted);
|
|
|
|
|
return body;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
logger.error("[getIpLocationInfo] IO Exception has occurred!", e);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|