Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

When we Refresh the page track the ip  RSS feed

 
anwar pasha
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When Refresh the page on banner,getting the ip address before the clicking or impression
-------------------------
Object reIp= remoteAddress(request);
String remoteIPAddress = reIp.toString();



public static InetAddress remoteAddress(HttpServletRequest request)throws UnknownHostException {
if (request.getHeader("x-forwarded-for") != null) {
return InetAddress.getByName(request.getHeader("x-forwarded-for"));
}
return InetAddress.getByName(request.getRemoteAddr());
}
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!