On Thu, Oct 23, 2003 at 04:40:05PM -0300, Samuel Mota wrote: > > I've extended the SessionLifeCycleListener class from Xwork to override the > sessionDestroyed(HttpSessionEvent e) method, but the session when this method is > called is totally > empty ... > > Webwork is inserting my component at the session (my validations are ok) but why I > cannot see it ?!?
When sessionDestroyed is called, the session is already invalidated an therefor not useable any more. That's why SessionLifeCycleListener binds an inner class which implements HttpSessionBindingListener to the Session. SessionDestroyed is actually empty in SessionLifeCycleListener. The following patch (unseted) will make SessionLifeCycleListener call "sessionToBeDestroyed" which you can override when needed. -billy. -- Meisterbohne Meisterbohne GbR, K�fner, Mekle, Meier Tel: +49-731-399 499-0 eL�sungen S�flinger Stra�e 100 Fax: +49-731-399 499-9 89077 Ulm http://www.meisterbohne.de/
--- src/java/com/opensymphony/webwork/lifecycle/SessionLifecycleListener.java.orig 2003-10-24 16:47:26.000000000 +0200 +++ src/java/com/opensymphony/webwork/lifecycle/SessionLifecycleListener.java 2003-10-24 16:55:19.000000000 +0200 @@ -39,13 +39,14 @@ log.debug("Session DefaultComponentManager : init"); } HttpSession session = event.getSession(); - ComponentManager container = new SessionComponentManager(); + ComponentManager container = new DefaultComponentManager(); ServletContext application = getServletContext(session); ComponentManager fallback = (ComponentManager) application.getAttribute("DefaultComponentManager"); container.setFallback(fallback); ComponentConfiguration config = (ComponentConfiguration) application.getAttribute("ComponentConfiguration"); config.configure(container, "session"); session.setAttribute("DefaultComponentManager", container); + session.setAttribute("SessionBindingListener", new SessionBindingListener()); } /** @@ -66,18 +67,18 @@ public void sessionDestroyed(HttpSessionEvent event) { } + protected void sessionToBeDestroyed(HttpSession session) { + ((ComponentManager) session.getAttribute("DefaultComponentManager")).dispose(); + } + //~ Inner Classes ////////////////////////////////////////////////////////// - class SessionComponentManager extends DefaultComponentManager implements HttpSessionBindingListener { + class SessionBindingListener implements HttpSessionBindingListener, Serializable { public void valueBound(HttpSessionBindingEvent event) { } public void valueUnbound(HttpSessionBindingEvent event) { - if (log.isDebugEnabled()) { - log.debug("Session DefaultComponentManager : destroy"); - } - - this.dispose(); + SessionLifecycleListener.this.sessionToBeDestroyed(event.getSession()); } } }