Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WICKET: how to get client's ip/address

Tags:

java

ip

wicket

I'm using wicket 1.5.1, couldn't figure this out.

public class MyPage extends WebPage {

public MyPage() {

    String clientAddress = ...?
like image 997
user995537 Avatar asked Oct 14 '11 14:10

user995537


People also ask

What is client IP address?

Client IP addresses describe only the computer being used, not the user. If multiple users share the same computer, they will be indistinguishable. Many Internet service providers dynamically assign IP addresses to users when they log in.


1 Answers

    WebRequest req = (WebRequest) RequestCycle.get().getRequest();
    HttpServletRequest httpReq = (HttpServletRequest) req.getContainerRequest();
    String clientAddress = httpReq.getRemoteHost();
like image 73
tetsuo Avatar answered Oct 05 '22 23:10

tetsuo