You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jacob Rhoden <ja...@rhoden.id.au> on 2007/10/23 05:47:38 UTC

Tomcat Manager session list "Gussed user name"

Hi,

I have recently discovered the tomcat manager can not only show a list 
of sessions, but the "Gussed username" for that session. This is very 
handy except it seems to read a session variable called "user" and just 
displays it. Our session object called "user" is a class not a string, 
show it displays things like "User@e37db8".

How do people manage this, do they implement a toString() to handle 
display of the user, or is there another way to teach the manager 
application the session name? (I am trying to find this in the source 
code but am only up to this so far:

------------------------------
public static String guessDisplayUserFromSession(Session in_session) {
    Object user = SessionUtils.guessUserFromSession(in_session);
    return escapeXml(user);
}
-------------------------------


Thanks,
Jacob


_________________________________________________
Jacob Rhoden
Application Architect
Systems Development and Integration
University of Melbourne

Phone: +61 3 8344 2884



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat Manager session list "Gussed user name"

Posted by Jacob Rhoden <ja...@rhoden.id.au>.
Jacob Rhoden wrote:
> I have recently discovered the tomcat manager can not only show a list 
> of sessions, but the "Gussed username" for that session. This is very 
> handy except it seems to read a session variable called "user" and 
> just displays it. Our session object called "user" is a class not a 
> string, show it displays things like "User@e37db8".
I am now going to answer my own question because digging through the 
source code got the answer quicker (: Tomcat searches the session for an 
object of type Principal, and uses the .toString() method to read the 
username. So if you have a session object called "user", make it extend 
"Principal" and add a toString() method so it displays user information 
in a nice format.

Happy session management! (:

Best Regards,
Jacob

-- 
_________________________________________________
Jacob Rhoden
Application Architect
Systems Development and Integration
University of Melbourne

Phone: +61 3 8344 2884



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org