address.setZone(response.getMostSpecificSubdivision().getIsoCode()); address.setCity(response.getCity().getName());
private GeoInfo _getGeoInfo(String ipAddress) { GeoInfo geoInfo = new GeoInfo(); if (ipAddress == null) { return geoInfo; } try{ InetAddress inetAddress = InetAddress.getByName(ipAddress); CityResponse response = reader.city(inetAddress); Country country = response.getCountry(); Continent continent = response.getContinent(); City city = response.getCity(); Postal postal = response.getPostal(); Location location = response.getLocation(); Subdivision subdivision = response.getMostSpecificSubdivision(); geoInfo.setRegion(subdivision.getName()); geoInfo.setCountryIsoCode(country.getIsoCode()); geoInfo.setCountry(country.getName()); geoInfo.setContinent(continent.getCode()); geoInfo.setCity(city.getName()); geoInfo.setPostalCode(postal.getCode()); geoInfo.setLatitude(location.getLatitude()); geoInfo.setLongitude(location.getLongitude()); return geoInfo; } catch(Exception ex){ return null; } }
break; case SUBDIVISION_NAME: if (response.getMostSpecificSubdivision() == null) { if (!this.required) { return ievent; geo.put("subdivision_name", response.getMostSpecificSubdivision().getName()); break; case SUBDIVISION_ISO_CODE: if (response.getMostSpecificSubdivision() == null) { if (!this.required) { return ievent; geo.put("subdivision_iso_code", response.getMostSpecificSubdivision().getIsoCode()); break; case CITY_NAME:
break; case SUBDIVISION_NAME: if (response.getMostSpecificSubdivision() == null) { if (!this.required) { return ievent; geo.put("subdivision_name", response.getMostSpecificSubdivision().getName()); break; case SUBDIVISION_ISO_CODE: if (response.getMostSpecificSubdivision() == null) { if (!this.required) { return ievent; geo.put("subdivision_iso_code", response.getMostSpecificSubdivision().getIsoCode()); break; case CITY_NAME: