One of the most common requirement is to get the IP Address of the client. You can use the following methods in a session scope bean.
public String getClientIpAddress() { String clientIpAddress = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr(); return clientIpAddress; }
Happy JDeveloping,
ZB
Hi Zeeshan Baig,
ReplyDeleteIs it works for proxy server concept. Please can you provide how to get client IP even if am using the proxy server.
Thanks & Reg,
Brahma..
is there a way to do this in BPEL and assign the ip to a bpel variable?
ReplyDeleteThanks,
Here is described approach to obtain client hostname behind proxy
ReplyDeletehttp://adfpractice-sokol.blogspot.com/2012/06/obtaining-hostname-and-printers-via.html