Browse files

http message sends over geoip info if available

  • Loading branch information...
1 parent 84cf340 commit 10fea667a3c3ee4611aadedebcf139f0b0908678 @rmarianski rmarianski committed Nov 6, 2012
View
13 ...munity/monitoring/src/main/java/org/geoserver/monitor/transport/HttpMessageTransport.java
@@ -129,9 +129,16 @@ private JSONObject serializeToJson(RequestData requestData) {
json.elementOpt("remoteUser", requestData.getRemoteUser());
json.elementOpt("referer", requestData.getHttpReferer());
- // TODO add remote geoip and address location once post processing is hooked up again
- // country/city and lat/lon
-
+ String country = requestData.getRemoteCountry();
+ String city = requestData.getRemoteCity();
+ // country and city only get set if we have geoip information
+ // if we don't check, we will send lat/lon values of 0 because those are primitive
+ if (country != null && city != null) {
+ json.element("country", country);
+ json.element("city", city);
+ json.elementOpt("latitude", requestData.getRemoteLat());
+ json.elementOpt("longitude", requestData.getRemoteLon());
+ }
json.element("serverHost", requestData.getHost());
json.element("internalHost", requestData.getInternalHost());

0 comments on commit 10fea66

Please sign in to comment.