HttpServletRequest request = servletWebRequest.getContainerRequest();
String ipAddress = request.getHeader("X-Forwarded-For");
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(
>
>
>
> But I am a beginner in wicket 1.5 and java, so I need some example code to
> get ip address, if it is possible.
> Thank you in advance
>
>
>
--
thank you,
regards,
Vineet Semwal
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]