Write a singleton SessionManager class something like
public class SessionManager {
/**
* Retrieves the current session from the request. Saves the session
* object if it is new.
*/
public static HttpSession getSession(HttpServletRequest req) {
...
}
/**
* Returns the list of active sessions.
*/
public static Enumeration getSessions() {
...
}
You'd also have to track session invalidation, but there several
of ways to do that, such as putting a well-known object in the session
and listening for its being unbound, or in getSessions asking each
session if it's valid, or having a reaper thread in the background.
The reason session enumeration was deprecated is that you could be
exposing sensitive information if such is stored in the session. Out of
curiosity, why do you want to display all the sessions this way?
Rod McChesney, Korobra
Byte Code wrote:
>
> We have an app that displays all active sessions on the server by getting a
> HttpSessionContext.
>
> As of JSDK 2.1 this seems to be depricated....
>
> How do we get all active sessions on the server now ??? There doesnt seem to be any
> replacement and getIds() is deprecated. it returns an empty enumeration ...
>
> HELLLLP.......Paninc !!
>
> -Sam
>
> ___________________________________________________________________________
> 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
___________________________________________________________________________
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