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.
Edit:
In wickets 1.54 the equivalent string is:
HttpServletRequest hsr = (HttpServletRequest)getRequestCycle().getRequest().getContainerRequest();
hsr.getAttribute("SERVER_NAME");
However, I always get a null string.
+3
source to share