This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
hi All, I am using some methods which are deprecated in JavaServlet API 2.1. I want to find the alternative, but the description in javadoc says that : Deprecated. As of Java Servlet API 2.1 with no replacement. I want to get the reference of all the existing (valid) sessions that has been created when the doGet or doPost of that servlet is invoked by a HttpServletRequest. I used HttpSessionContext.getSessionContext(); and from I obtain the enumeration of session IDs. but the method is deprecated. Kindly let me know of nay alternative to get the list of sessions. I need the solution fast. regards and thanks in advance Tanveer
Basically what I want to do is to restrict only one session from one IP (machine) at a time. The simplified code is somewhat like this:
[ September 12, 2002: Message edited by: Tanveer Rameez ]
Author of JPhotoBrush Pro (www.jphotobrushpro.com)
Originally posted by Tanveer Rameez: I used HttpSessionContext.getSessionContext(); and from I obtain the enumeration of session IDs. but the method is deprecated. Kindly let me know of nay alternative to get the list of sessions. I need the solution fast.
Hi, Tanveer, I've encounterd a similar problem and have not solved it yet, but I think I just found the solution on the webpage of More Servlets and JavaServer Pages. Go to Chapter 10 and locate the sourcecode for SessionCounter.java. This class is an exampe for a Session Listener (available since Servlet 2.3) which offers the following 2 methods: public void sessionCreated(HttpSessionEvent event) public void sessionDestroyed(HttpSessionEvent event) Those can be used to get some Information about the sessions. Like described in this example you can save the relevant information in the servlet context and make it available to the servlet. Hope it helps, I will try it out tonight... Hartmut [ September 12, 2002: Message edited by: Hartmut Ludwig ]