Java Code Examples for com.maxmind.geoip2.model.IspResponse#toJson()
The following examples show how to use
com.maxmind.geoip2.model.IspResponse#toJson() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MMDB.java From bidder with Apache License 2.0 | 6 votes |
public String solve(String key) { String value = null; try { String parts[] = key.split("/"); if (parts.length < 3) return null; String sip = parts[2]; InetAddress ip = InetAddress.getByName(sip); IspResponse r = reader.isp(ip); switch (parts[1]) { case "org": return r.getOrganization(); case "isp": return r.getIsp(); case "json": return r.toJson(); default: return null; } } catch (Exception e) { } return value; }
Example 2
Source File: MMDB.java From XRTB with Apache License 2.0 | 6 votes |
public String solve(String key) { String value = null; try { String parts[] = key.split("/"); if (parts.length < 3) return null; String sip = parts[2]; InetAddress ip = InetAddress.getByName(sip); IspResponse r = reader.isp(ip); switch (parts[1]) { case "org": return r.getOrganization(); case "isp": return r.getIsp(); case "json": return r.toJson(); default: return null; } } catch (Exception e) { } return value; }