How to get server variables using apache wicket 1.54?

I am trying to get the name and ip of the current server my web application is running on. I'm not sure how to do this, this is wicket 1.54. I need to know how to get my server variables.

In wickets 1.4 you can do:

HttpServletRequest hsr = getWebRequestCycle().getWebRequest().getHttpServletRequest();


Then you can use hsr to capture headers or attributes.


In wickets 1.54 the equivalent string is:

HttpServletRequest hsr = (HttpServletRequest)getRequestCycle().getRequest().getContainerRequest();


However, I always get a null string.


source to share

1 answer

This works for me with Wicket 1.5.5 inside a webpage:

HttpServletRequest request = (HttpServletRequest) getRequest().getContainerRequest();
String serverName = request.getServerName();
String remoteAddr = request.getRemoteAddr();




All Articles