Jerry Jacob's Blog

Client IP Address in Java

Posted in Java/ J2EE by jerlinworld on May 6, 2013

//IP address of request's HTTP header ""X-FORWARDED-FOR"

String ipAdr = request.getHeader("X-FORWARDED-FOR");

if (ipAdr == null) {

ipAdr = request.getRemoteAddr();

}

Opensource RESTful API for searching the geolocation of IP Addresses and hostnames.
https://github.com/fiorix/freegeoip (http://freegeoip.net/)

Advertisements
Tagged with:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: