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:
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.
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