Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Tomcat sessions user's id list

Reply
Thread Tools

Tomcat sessions user's id list

 
 
Rejean
Guest
Posts: n/a
 
      08-03-2004
Hi,

I'm looking for how to retrieve the list of user's, log into and
application in tomcat, via tomcat manager I can see the number of
sessions, but I need to retrieve the user id of those sessions.

Thanks!
 
Reply With Quote
 
 
 
 
William Brogden
Guest
Posts: n/a
 
      08-04-2004
On 3 Aug 2004 12:28:38 -0700, Rejean <(E-Mail Removed)> wrote:

> Hi,
>
> I'm looking for how to retrieve the list of user's, log into and
> application in tomcat, via tomcat manager I can see the number of
> sessions, but I need to retrieve the user id of those sessions.
>
> Thanks!


You will have to do some programming - look into the various
session "Listener" interfaces such as HttpSessionListener.
Bill


--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/
 
Reply With Quote
 
 
 
 
Rejean
Guest
Posts: n/a
 
      08-05-2004
"William Brogden" <(E-Mail Removed)> wrote in message news:<opsb7kvfsnk0yerx@ruby>...
> On 3 Aug 2004 12:28:38 -0700, Rejean <(E-Mail Removed)> wrote:
>
> > Hi,
> >
> > I'm looking for how to retrieve the list of user's, log into and
> > application in tomcat, via tomcat manager I can see the number of
> > sessions, but I need to retrieve the user id of those sessions.
> >
> > Thanks!

>
> You will have to do some programming - look into the various
> session "Listener" interfaces such as HttpSessionListener.
> Bill


Ok Thanks, I did a little research, created a tag in the web.xml
<listener>
<listener-class>
ca.qc.toto.cop.SessionListener
</listener-class>
</listener>


And created a class
/*
* Created on Aug 5, 2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
Comments
*/
package ca.qc.toto.cop;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

/**
* @author cf1926
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and
Comments
*/
public class SessionListener implements HttpSessionListener {

private static Map sessions = new HashMap();

/* (non-Javadoc)
* @see javax.servlet.http.HttpSessionListener#sessionCrea ted(javax.servlet.http.HttpSessionEvent)
*/
public void sessionCreated(HttpSessionEvent arg0) {
System.out.println("Nouvelle session");
sessions.put("Nouveau nom","");
System.out.println(arg0.getSession().getId());

}

/* (non-Javadoc)
* @see javax.servlet.http.HttpSessionListener#sessionDest royed(javax.servlet.http.HttpSessionEvent)
*/
public void sessionDestroyed(HttpSessionEvent arg0) {
sessions.remove("Nouveau nom");
}

/**
* @return
*/
public static Map getSessions() {
return sessions;
}

/**
* @param map
*/
public static void setSessions(Map map) {
sessions = map;
}

}

But now I can seem to get the remote user login id .... any ideas.

Thanks!
 
Reply With Quote
 
Ashok Swaminathan Ashok Swaminathan is offline
Junior Member
Join Date: Aug 2007
Posts: 3
 
      08-20-2007
In my tomcat based test server for a special purpose, ALL listeners are reporting and behaving perfectly, except that the HttpSesssionListener is not reporting a sessionEvent even though the doPost method in the servlet is doing its job perfectly. No error in code, I can assure you.This test is being conducted locally on the same machine.

Not sessionCreated not sessionDestroyed.

Any ideas on why HttpSessionEvent is not generated? Or detected? The web.xml for this application deployed is reproduced below in extract.

</description>
<servlet>
<servlet-name>LoadCandidateJSP</servlet-name>

<servlet-class>tcsi.webcvws.services.web.LoadCandidateJSP</servlet-class>
<init-param>
<param-name>readonly</param-name>
<param-value>false</param-value>
</init-param>

<load-on-startup>1</load-on-startup>

<session-config>
<session-timeout>1</session-timeout>
</session-config>
</servlet>
<listener>
<listener-class>
tcsi.webcvws.services.web.CandidateSessionListener
</listener-class>
</listener>


Thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Moving from ASP Sessions to Database Sessions Bookham Measures ASP General 19 08-23-2007 03:51 PM
Cookieless Sessions (Sessions Without Cookies) and Security scottymo ASP .Net Security 3 09-29-2006 11:00 PM
two simultaneous tomcat sessions for the same user michel carriere Java 2 12-18-2003 05:07 AM
[Q] Tomcat sessions Daniel Schneller Java 4 10-13-2003 07:36 AM
Re: Relationship between IIS Sessions and ASP.NET Sessions? Ken Cox [Microsoft MVP] ASP .Net 1 08-08-2003 03:22 PM



Advertisments