myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hansjörg Meuschel <hj...@gmx.de>
Subject Re: probems getting the remote ip address in a bean
Date Thu, 01 Jun 2006 11:49:57 GMT
Thank you Matthias!

Greets,
Hans

Matthias Wessendorf wrote:

> Why are you casting against ServletContext?
>
> HttpServletReq should be enough.
>
> com.sun.faces. is code from the RI, shipped under the sun ;-)
>
> Regards,
> Matthias
>
> On 6/1/06, Hansjörg Meuschel <hjmeu@gmx.de> wrote:
>
>> Hello,
>> in a bean, how can I extract the IP adress of a user?
>>
>> I tried
>>
>>         HttpServletRequest request =
>> (HttpServletRequest)((ServletContext)
>> FacesContext.getCurrentInstance().getExternalContext().getRequest());
>>         String IP = request.getRemoteHost();
>>
>> but whatever I did I got
>>
>>         java.lang.ClassCastException:
>> com.sun.faces.context.MyHttpServletRequestWrapper
>>
>> Any ideas? Thanks a lot... Hans
>>
>
>


Mime
View raw message