Saturday, August 7, 2010

How to get Client IP Address in ADF Fusion Application

Hi,

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

3 comments:

  1. Hi Zeeshan Baig,

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

    ReplyDelete
  2. is there a way to do this in BPEL and assign the ip to a bpel variable?

    Thanks,

    ReplyDelete
  3. Here is described approach to obtain client hostname behind proxy
    http://adfpractice-sokol.blogspot.com/2012/06/obtaining-hostname-and-printers-via.html

    ReplyDelete