FileDocCategorySizeDatePackage
ChatListener.javaAPI DocExample3470Sun Feb 08 21:34:02 GMT 2004darwinsys.chat

ChatListener

public class ChatListener extends Object implements HttpSessionListener, ServletContextListener, ChatConstants
Package 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

Fields Summary
Constructors Summary
Methods Summary
public voidcontextDestroyed(javax.servlet.ServletContextEvent e)

		System.out.println("Chat Application Destroyed");
	
public voidcontextInitialized(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 voidsessionCreated(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 voidsessionDestroyed(javax.servlet.http.HttpSessionEvent e)

		// Log this, but the Session is already destroyed.
		System.out.println("Chat User Removed");