FileDocCategorySizeDatePackage
ChatSessionListener.javaAPI DocApache Struts 2.0.9 Apps2180Mon Jul 23 13:43:26 BST 2007org.apache.struts2.showcase.chat

ChatSessionListener

public class ChatSessionListener extends Object implements HttpSessionListener

Fields Summary
private static final Log
_log
Constructors Summary
Methods Summary
public voidsessionCreated(javax.servlet.http.HttpSessionEvent event)


        
    
public voidsessionDestroyed(javax.servlet.http.HttpSessionEvent event)

        HttpSession session = event.getSession();
        WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(session.getServletContext());
        if (context != null) {
            User user = (User) session.getAttribute(ChatInterceptor.CHAT_USER_SESSION_KEY);
            if (user != null) {
                ChatService service = (ChatService) context.getBean("chatService");
                service.logout(user.getName());

                _log.info("session expired, logged user ["+user.getName()+"] out");
            }
        }