Saturday, December 4, 2010

Get Remote IP

To get the Client System's (Remote) IP Address through portlet request:


HttpServletRequest request = PortalUtil.getHttpServletRequest(actionrequest);
String clientIp = PortalUtil.getOriginalServletRequest(request).getRemoteAddr();


or


String clientIp = PortalUtil.getHttpServletRequest(request).getRemoteAddr();

--
Warm Regards,

K.Gnaniyar Zubair,

2 comments:

zuber Khalpa said...

This code return your localhost ip. You r in nerwork then it return your network ip. It is not return your globle ip or live ip.

zuber Khalpa said...

For globle ip u need web service api,ther r many web service available to get your actual ip or globle ip

Post a Comment

Share & Enjoy

Twitter Delicious Facebook Digg Stumbleupon Favorites More