In Tomcat Manager on the Page "Sessions Administration", there is a column Guessed User name. How can i set this column from within my Wicket Session?
Note: I have successfully overridden AuthenticatedWebSession.toString()
and this value is shown on the sessin details page.
I have tried to set AuthenticatedWebSession.userName
as recommended here.
Please mind that Wicket session is a different beast than actual servlet session. Creating a "userName" property in wicket session will not work.
You need to access the raw HttpServletRequest from wicket to set the value properly: this is how you do it.
Add this code to your WebPages:
HttpServletRequest request = getWebRequestCycle().getWebRequest().getHttpServletRequest();
request.getSession().setAttribute("userName", userName);
You can create any Java bean and add it to session like this, session.setAttribute("user", user); Tomcat will find the bean and whatever prints in toString will show up. see image here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With