ChatListenerpublic class ChatListener extends Object implements HttpSessionListener, ServletContextListener, ChatConstantsPackage darwinsys.chat implements a simple servlet-based chat application.
This class does much of the work of the Chat application,
including registering/deregistering users in the List |
Methods Summary |
---|
public void | contextDestroyed(javax.servlet.ServletContextEvent e)
System.out.println("Chat Application Destroyed");
| public void | contextInitialized(javax.servlet.ServletContextEvent e)The Chat Application is starting up. Create all of its global data!
ServletContext ctx = e.getServletContext();
ctx.setAttribute(APP_STATE, new ChatState());
System.out.println("Chat Application Initialized");
| public void | sessionCreated(javax.servlet.http.HttpSessionEvent e)Called when a new user comes along. Create a null
UserState object and store it in the session.
HttpSession sess = e.getSession();
sess.setAttribute(USER_STATE, new UserState());
// XXX Get the ServletContext and add the user to it.
System.out.println("Chat User Set Up");
| public void | sessionDestroyed(javax.servlet.http.HttpSessionEvent e)
// Log this, but the Session is already destroyed.
System.out.println("Chat User Removed");
|
|