myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1073074 - in /myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl: listener/phase/ scope/conversation/
Date Mon, 21 Feb 2011 17:18:07 GMT
Author: gpetracek
Date: Mon Feb 21 17:18:06 2011
New Revision: 1073074

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

Removed:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/RenderingObserver.java
Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ViewAccessConversationExpirationEvaluatorRegistry.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextManagerObserver.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java?rev=1073074&r1=1073073&r2=1073074&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/phase/CodiLifecycleWrapper.java
Mon Feb 21 17:18:06 2011
@@ -23,13 +23,20 @@ import org.apache.myfaces.extensions.cdi
 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.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.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.lifecycle.Lifecycle;
 import javax.faces.event.PhaseListener;
 import javax.faces.context.FacesContext;
 import javax.faces.FacesException;
+import javax.enterprise.inject.spi.BeanManager;
 import java.util.List;
 
 /**
@@ -98,6 +105,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:

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ViewAccessConversationExpirationEvaluatorRegistry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ViewAccessConversationExpirationEvaluatorRegistry.java?rev=1073074&r1=1073073&r2=1073074&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ViewAccessConversationExpirationEvaluatorRegistry.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/ViewAccessConversationExpirationEvaluatorRegistry.java
Mon Feb 21 17:18:06 2011
@@ -52,7 +52,7 @@ public class ViewAccessConversationExpir
         this.viewAccessConversationExpirationEvaluatorList.add(evaluator);
     }
 
-    void broadcastRenderedViewId(String viewId)
+    public void broadcastRenderedViewId(String viewId)
     {
         for(ViewAccessConversationExpirationEvaluator evaluator : this.viewAccessConversationExpirationEvaluatorList)
         {

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextManagerObserver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextManagerObserver.java?rev=1073074&r1=1073073&r2=1073074&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextManagerObserver.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/scope/conversation/WindowContextManagerObserver.java
Mon Feb 21 17:18:06 2011
@@ -159,19 +159,6 @@ public class WindowContextManagerObserve
         }
     }
 
-    protected void cleanupAndRecordCurrentViewAsOldViewId(
-            @Observes @AfterPhase(JsfPhaseId.RENDER_RESPONSE) PhaseEvent phaseEvent,
-            EditableWindowContextManager windowContextManager,
-            WindowContextConfig windowContextConfig)
-    {
-        storeCurrentViewIdAsOldViewId(phaseEvent.getFacesContext());
-
-        if(windowContextConfig.isCloseEmptyWindowContextsEnabled())
-        {
-            cleanupInactiveWindowContexts(windowContextManager);
-        }
-    }
-
     /**
      * an external app might call a page without url parameter.
      * to support such an use-case it's possible to



Mime
View raw message