Per the documentation, HttpSessionContext is a deprecated interface;
implementations of the method getIds() must return an empty enumeration.

----- Original Message -----
From: Jayaraman Anantharaman <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, August 13, 2000 4:09 AM
Subject: HttpSessionContext.getIds()


> Hi,
> I'm fairly new to servlets. I'm trying to get all the active sessions
using
> the following code:
>
> --------------------
>     public void doGet(HttpServletRequest req, HttpServletResponse res)
> throws ServletException, IOException
>     {
>         res.setContentType("text/html");
>         PrintWriter out  = res.getWriter();
>
>         HttpSession session = req.getSession(true);
>
>         out.println("<HTML><BODY>");
>         out.println(" getId() : "+session.getId()+"<BR>");
>         out.println(" getLastAccessedTime() : "+ new
> Date(session.getLastAccessedTime())+"<BR>");
>
>         HttpSessionContext ctx = (HttpSessionContext)
> session.getSessionContext();
>
>         Enumeration ids = ctx.getIds();
>         out.println("out "+ids+"<BR>");
>         while(ids.hasMoreElements())
>         {
>             out.println("in "+"<BR>");
>             String id = (String) ids.nextElement();
>             HttpSession ses = ctx.getSession(id);
>             out.println(id + " : "+ ses.getId() + "<BR>");
>         }
>
>         out.println("</BODY></HTML>");
>
>     }
> ---------------------------
>
>  And I'm getting the following output:
> ---------------------------
> getId() : 20921df3e44b221e
> getLastAccessedTime() : Sun Aug 13 15:41:38 GMT+05:30 2000
> out java.util.HashtableEnumerator@1ae245
> --------------------------
>
> As you see, enumeration of ids does not even have the id pertaining to the
> session in which I am. It is totally blank.
>
> May be I think there is some minor mistake on my part but it'll be great
if
> you could point it out.
> Thanks
> Jram.
>
>
___________________________________________________________________________
> 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

Reply via email to