How can i find client's ip?

I use Sun Studio creator developing jsf portlets deploying on Tomcat+JBoss LIferay portal.My problem is that i cannot find how could i get client's ip address?Thanks a lot in advance.
[205 byte] By [epp-665a] at [2007-11-14]
# 1
You need HttpServletRequest#getRemoteAddr().
BalusCa at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 2
Thanks for the reply dear BalusC ,Yes but i don't have direct access to the servlet request to call getRemoteAddr(). At least not with what i see-can get through sun studio creator's jsf portlet page.
epp-665a at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 3
((HttpServletRequest)FacesContext.getExternalContext() .getRequest()).getRemoteAddr();
RahulSharnaa at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 4
Indeed, the HttpServletRequest is just accessible by the ExternalContext as you can see here above =)
BalusCa at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 5
I tried this but i get: non static method getExternalContext() cannot be referenced from a static context. Any idea about this, cause i'm a little bit confused?
epp-665a at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 6
The right way is: String remoteAddr = ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr();
BalusCa at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 7
Dear BalusC,It seems working. :) (I dont have right now any other pc on the network to ckeck it, but thanks a lot it seems working fine).
epp-665a at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 8

:( Unfortunately it was the javascript i entered behind the button and not the possible solution(String remoteAddr = ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getRemoteAddr();

)! :) It returns me null. Is there any idea about this?

I place this code inside the custom class: "portletPage1" which extends AbstractPageBean.

epp-665a at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 9
Try casting to PortletRequest instead of HttpServletRequest.
BalusCa at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...
# 10
Dear BalusC,Your help was valuable. Now it really seems working fine.(Note: Instead of getRemoteAddr(), i used getRemoteUser() cause the first one does not exists for PortletRequest ).Best Regards.
epp-665a at 2007-7-11 > top of java,Enterprise & Remote Computing,Web Tier APIs...