((ServletWebRequest)
RequestCycle.get().getRequest()).getContainerRequest().getRemoteHost()
François
Le 21 nov. 2011 à 08:20, vineet semwal a écrit :
> ServletWebRequest servletWebRequest = (ServletWebRequest)
> getRequestCycle().getRequest();
> HttpServletRequest request =
> servletWebRequest.getContainerRequest();
> String ipAddress = request.getHeader("X-Forwarded-For");
>
> On Mon, Nov 21, 2011 at 12:41 PM, Paolo <[email protected]> wrote:
>> Alle domenica 20 novembre 2011, vineet semwal ha scritto:
>>> HttpServletRequest request = servletWebRequest.getContainerRequest();
>>> String ipAddress = request.getHeader("X-Forwarded-For");
>>>
>>
>> Thank you for your very fast reply.
>> I implemented your code:
>>
>> HttpServletRequest request = ServletWebRequest.getContainerRequest();
>> String ipAddress = request.getHeader("X-Forwarded-For");
>>
>> but I got this error on the first line:
>> Cannot make a static reference to the non-static method
>> getContainerRequest() from the type ServletWebRequest
>>
>> Can you help me?
>> Thak you so much.
>>
>>> On Sun, Nov 20, 2011 at 4:41 PM, Paolo <[email protected]> wrote:
>>>> I need to known the ip address of the user connected to my tomcat server.
>>>> In previous post, I read about...
>>>>
>>>> getWebRequestCycle().getWebRequest().getHttpServletRequest().getRemoteAddr();
>>>>
>>>> But I also find some documentation with google that in Wicket 1.5 I should
>>>> use WebClientInfo:
>>>>
>>>> getRemoteAddr
>>>> protected String getRemoteAddr(RequestCycle requestCycle)
>>>> When using ProxyPass, requestCycle().getHttpServletRequest().
>>>> getRemoteAddr() returns the IP of the machine forwarding the request. In
>>>> order to maintain the clients ip address, the server places it in the
>>>> X-Forwarded-For Header.
>>>> Parameters:
>>>> requestCycle - the request cycle
>>>> Returns:
>>>> remoteAddr IP address of the client, using the X-Forwarded-For header and
>>>> defaulting to: getHttpServletRequest().getRemoteAddr(
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>
>
>
> --
> thank you,
>
> regards,
> Vineet Semwal
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]