myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1073083 - /myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
Date Mon, 21 Feb 2011 17:26:08 GMT
Author: gpetracek
Date: Mon Feb 21 17:26:08 2011
New Revision: 1073083

URL: http://svn.apache.org/viewvc?rev=1073083&view=rev
Log:
EXTCDI-124 cleanup

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java?rev=1073083&r1=1073082&r2=1073083&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf20-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf2/impl/listener/phase/CodiLifecycleWrapper.java
Mon Feb 21 17:26:08 2011
@@ -20,16 +20,24 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.core.impl.util.ClassDeactivation;
 import org.apache.myfaces.extensions.cdi.core.impl.util.CodiUtils;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.config.WindowContextConfig;
+import org.apache.myfaces.extensions.cdi.core.api.provider.BeanManagerProvider;
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.request.BeforeAfterFacesRequestBroadcaster;
 import org.apache.myfaces.extensions.cdi.jsf.impl.listener.startup.ApplicationStartupBroadcaster;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.WindowHandler;
 import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.LifecycleAwareWindowHandler;
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.spi.EditableWindowContextManager;
+import org.apache.myfaces.extensions.cdi.jsf.impl.scope.conversation.ViewAccessConversationExpirationEvaluatorRegistry;
 import org.apache.myfaces.extensions.cdi.jsf.impl.util.RequestCache;
+import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.storeCurrentViewIdAsOldViewId;
+import static org.apache.myfaces.extensions.cdi.jsf.impl.util.ConversationUtils.cleanupInactiveWindowContexts;
+
 
 import javax.faces.FacesException;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseListener;
 import javax.faces.lifecycle.Lifecycle;
+import javax.enterprise.inject.spi.BeanManager;
 import java.util.List;
 
 /**
@@ -98,6 +106,29 @@ class CodiLifecycleWrapper extends Lifec
             throws FacesException
     {
         wrapped.render(facesContext);
+
+        //don't move it to an observer
+        BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
+
+        EditableWindowContextManager windowContextManager =
+                CodiUtils.getContextualReferenceByClass(beanManager, EditableWindowContextManager.class);
+
+        WindowContextConfig windowContextConfig =
+                CodiUtils.getContextualReferenceByClass(beanManager, WindowContextConfig.class);
+
+        ViewAccessConversationExpirationEvaluatorRegistry registry =
+                CodiUtils.getContextualReferenceByClass(
+                        beanManager, ViewAccessConversationExpirationEvaluatorRegistry.class);
+
+        registry.broadcastRenderedViewId(facesContext.getViewRoot().getViewId());
+
+        storeCurrentViewIdAsOldViewId(facesContext);
+
+        if(windowContextConfig.isCloseEmptyWindowContextsEnabled())
+        {
+            cleanupInactiveWindowContexts(windowContextManager);
+        }
+
         //if the cache would get resetted by an observer or a phase-listener
         //it might be the case that a 2nd observer accesses the cache again and afterwards
there won't be a cleanup
         //-> don't remove:



Mime
View raw message