RE: Enumerating sessions

2004-06-15 Thread Frank Zammetti
It does, thank you.  I was just starting to come to the same basic approach 
on my own, you verified it's probably the right way to go.  Fortunately I 
already store the sessionID in my user table (for debugging purposes of a 
previous problem, but I just left it in).  So now I just have to add the 
listener and I should get what I want.

For the broadcast messages requirement, I was trying to figure out how to 
access all the sessions to add a message attribute to it that I could check 
on the next request, but that doesn't seem to be possible.  Fortunately, 
it's also not necassery... because my Actions all make use of a helper 
class, and the first thing they all do is call a special startAction() 
method, I can just check my static app config object, which is where I will 
put the broadcast message, and return it with whatever the request is.  Just 
need to implement a JavaScript popup on the client if the message is found 
in the response, and I'm all set.  I could probably even do this as some 
sort of filter instead, but since I already have the helper there (it's an 
artifact of the app being converted from an old custom framework), it's a 
good place for it.

Thanks a bunch guys!
Frank
From: "Van Riper, Mike" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Subject: RE: Enumerating sessions
Date: Tue, 15 Jun 2004 13:57:54 -0700
I had to do something like this and I did use the HttpSessionListener
interface (requires 2.3 servlet API support in your container) as part of
the solution. However, it alone is not sufficient. The callbacks for the
session creation and destruction events happen so early and so late
respectively that you do not have access to any session data other than the
sessionID. The solution I came up with was to record logins within the
webapp to a tracking table *and* store the sessionID as a field in these
records. Then, you can use the sessionDestroyed() callback to check to see
if there is a login record that is still active that needs to be flagged as
terminated. You have to go through all these hoops because you can't rely 
on
the user explicitly logging out. So, to update the tracking table to
reliably indicate who is currently logged in you have to do this. You will
hit the sessionDestroyed() callback whether they explicitly log out and you
expire the session, or the session simply times out on its own because of
inactivity (or as a result of closing the client-side browser window 
without
explicitly logging out).

Hope this helps, Van
Mike "Van" Riper
Silicon Valley Struts User Group
http://www.baychi.org/bof/struts/
mailto:[EMAIL PROTECTED]
> -Original Message-
> From: Nick Heudecker [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 15, 2004 1:43 PM
> To: Struts Users Mailing List
> Subject: Re: Enumerating sessions
>
>
> Wouldn't this do it?
>
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/jav
> ax/servlet/http/HttpSessionListener.html
>
> Frank Zammetti wrote:
>
> > Hello all... is there any good way to enumerate all
> sessions under a
> > given webapp?  I know there used to be the SessionContext,
> but that has
> > since been deprecated as of servlet spec 2.1 I believe... Is there
> > anything in Struts that might help?
> >
> > Basically I'm just looking for an accurate way to display
> all currently
> > logged on users, and also have the ability to add a session
> attribute to
> > all of them (think broadcast messages and forced graceful
> logoffs).  I
> > keep hearing the term "Session Listenter", but my research
> is turning up
> > server-specific (or third party-specific references), and I
> need this to
> > be server-nuetral.
> >
> > I could I guess create a wrapper class that is called to
> create or kill
> > a session, as well as to add of remove attributes, but I'd prefer
> > something that won't require me to change a lot of code, or
> any really!
> >
> > Thanks in advance for any ideas!
> >
> > Frank
> >
> > _
> > MSN 9 Dial-up Internet Access fights spam and pop-ups – now
> 3 months
> > FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/
> >
> >
> >
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> --
> Nick Heudecker
> System Mobile, Inc.
> Email: [EMAIL PROTECTED]
> Web: http://www.systemmobile.com
>
> --

RE: Enumerating sessions

2004-06-15 Thread Van Riper, Mike
I had to do something like this and I did use the HttpSessionListener
interface (requires 2.3 servlet API support in your container) as part of
the solution. However, it alone is not sufficient. The callbacks for the
session creation and destruction events happen so early and so late
respectively that you do not have access to any session data other than the
sessionID. The solution I came up with was to record logins within the
webapp to a tracking table *and* store the sessionID as a field in these
records. Then, you can use the sessionDestroyed() callback to check to see
if there is a login record that is still active that needs to be flagged as
terminated. You have to go through all these hoops because you can't rely on
the user explicitly logging out. So, to update the tracking table to
reliably indicate who is currently logged in you have to do this. You will
hit the sessionDestroyed() callback whether they explicitly log out and you
expire the session, or the session simply times out on its own because of
inactivity (or as a result of closing the client-side browser window without
explicitly logging out).

Hope this helps, Van

Mike "Van" Riper
Silicon Valley Struts User Group
http://www.baychi.org/bof/struts/
mailto:[EMAIL PROTECTED]

> -Original Message-
> From: Nick Heudecker [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, June 15, 2004 1:43 PM
> To: Struts Users Mailing List
> Subject: Re: Enumerating sessions
> 
> 
> Wouldn't this do it?
> 
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/jav
> ax/servlet/http/HttpSessionListener.html
> 
> Frank Zammetti wrote:
> 
> > Hello all... is there any good way to enumerate all 
> sessions under a 
> > given webapp?  I know there used to be the SessionContext, 
> but that has 
> > since been deprecated as of servlet spec 2.1 I believe... Is there 
> > anything in Struts that might help?
> > 
> > Basically I'm just looking for an accurate way to display 
> all currently 
> > logged on users, and also have the ability to add a session 
> attribute to 
> > all of them (think broadcast messages and forced graceful 
> logoffs).  I 
> > keep hearing the term "Session Listenter", but my research 
> is turning up 
> > server-specific (or third party-specific references), and I 
> need this to 
> > be server-nuetral.
> > 
> > I could I guess create a wrapper class that is called to 
> create or kill 
> > a session, as well as to add of remove attributes, but I'd prefer 
> > something that won't require me to change a lot of code, or 
> any really!
> > 
> > Thanks in advance for any ideas!
> > 
> > Frank
> > 
> > _
> > MSN 9 Dial-up Internet Access fights spam and pop-ups – now 
> 3 months 
> > FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/
> > 
> > 
> > 
> -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> -- 
> Nick Heudecker
> System Mobile, Inc.
> Email: [EMAIL PROTECTED]
> Web: http://www.systemmobile.com
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Enumerating sessions

2004-06-15 Thread Nick Heudecker
Wouldn't this do it?
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/servletapi/javax/servlet/http/HttpSessionListener.html
Frank Zammetti wrote:
Hello all... is there any good way to enumerate all sessions under a 
given webapp?  I know there used to be the SessionContext, but that has 
since been deprecated as of servlet spec 2.1 I believe... Is there 
anything in Struts that might help?

Basically I'm just looking for an accurate way to display all currently 
logged on users, and also have the ability to add a session attribute to 
all of them (think broadcast messages and forced graceful logoffs).  I 
keep hearing the term "Session Listenter", but my research is turning up 
server-specific (or third party-specific references), and I need this to 
be server-nuetral.

I could I guess create a wrapper class that is called to create or kill 
a session, as well as to add of remove attributes, but I'd prefer 
something that won't require me to change a lot of code, or any really!

Thanks in advance for any ideas!
Frank
_
MSN 9 Dial-up Internet Access fights spam and pop-ups – now 3 months 
FREE! http://join.msn.click-url.com/go/onm00200361ave/direct/01/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

--
Nick Heudecker
System Mobile, Inc.
Email: [EMAIL PROTECTED]
Web: http://www.systemmobile.com
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]