>>> Robbie Hazlewood <[EMAIL PROTECTED]> 24-Mar-01 12:07:26 PM >>>

>I have already posted this message, but I'm reposting
>as I did not get a reply, and I'm getting pretty desperate.

You didn't get a reply because this has been answered before (you
should always check the archives) and because the information is
actually quite widely available.


>Is there a way to get access to all active sessions?

There used to be. Sessions could be placed in a SessionContext which
allowed you to enumerate them all. But it was depreceated and the
behaviour changed to remove it's effect.

This was done because of security concerns.

Nowadays it may not be such a problem because sessions are created
within a ServletContext and the ServletContext is seen as the main
security boundary.


>I wrote some stuff to put all new sessions in a
>hashtable so they can be accessed. (using a
>subclass of httpsessionlistener, so they are removed
>when the session expires)
>I'm getting some strange results with this though.
>Is there a 'proper' way of doing this? What is the best
>work around?

What you're doing is (as of API 2.2) the only way to achieve the
result.

It works strange on some versions of Tomcat because Tomcat for some
reason recycles session objects to represent different sessions.

Why it does that I don't know.

Other servlet engines don't do it so if you're using Tomcat and you
need to do this I'd have to recomend that you try another engine.


Nic Ferrier

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to