myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject svn commit: r1054593 - in /myfaces/extensions/cdi/trunk/jee-modules/jsf-module: api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/ impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/request/
Date Mon, 03 Jan 2011 12:35:27 GMT
Author: gpetracek
Date: Mon Jan  3 12:35:27 2011
New Revision: 1054593

URL: http://svn.apache.org/viewvc?rev=1054593&view=rev
Log:
EXTCDI-116 workaround for owb issue

Modified:
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/AfterFacesRequest.java
    myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/request/FacesMessageObserver.java

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/AfterFacesRequest.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/AfterFacesRequest.java?rev=1054593&r1=1054592&r2=1054593&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/AfterFacesRequest.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/jsf/api/listener/request/AfterFacesRequest.java
Mon Jan  3 12:35:27 2011
@@ -31,7 +31,10 @@ import java.lang.annotation.Target;
  * destroyed.
  *
  * Parameter-type of the observer: {@link javax.faces.context.FacesContext}
- * 
+ *
+ * Attention: referencing @ApplicationScoped or @Singleton scoped beans might lead to issues
with a CDI implementation
+ * (e.g. if the ServletRequestListener of OWB gets called earlier)
+ *
  * @author Gerhard Petracek
  */
 

Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/request/FacesMessageObserver.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/request/FacesMessageObserver.java?rev=1054593&r1=1054592&r2=1054593&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/request/FacesMessageObserver.java
(original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/jsf/impl/listener/request/FacesMessageObserver.java
Mon Jan  3 12:35:27 2011
@@ -20,12 +20,12 @@ package org.apache.myfaces.extensions.cd
 
 import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
 import org.apache.myfaces.extensions.cdi.jsf.api.config.JsfModuleConfig;
-import org.apache.myfaces.extensions.cdi.jsf.api.listener.phase.JsfLifecyclePhaseInformation;
-import org.apache.myfaces.extensions.cdi.jsf.api.listener.request.AfterFacesRequest;
+import org.apache.myfaces.extensions.cdi.jsf.api.listener.phase.AfterPhase;
+import org.apache.myfaces.extensions.cdi.jsf.api.listener.phase.JsfPhaseId;
 import org.apache.myfaces.extensions.cdi.message.api.Message;
 
 import javax.enterprise.event.Observes;
-import javax.faces.context.FacesContext;
+import javax.faces.event.PhaseEvent;
 import javax.inject.Inject;
 import java.util.List;
 import java.util.Map;
@@ -37,9 +37,6 @@ import java.util.concurrent.CopyOnWriteA
 public class FacesMessageObserver
 {
     @Inject
-    private JsfLifecyclePhaseInformation lifecyclePhaseInformation;
-
-    @Inject
     private WindowContext windowContext;
 
     private boolean alwaysKeepMessages;
@@ -54,11 +51,13 @@ public class FacesMessageObserver
         this.alwaysKeepMessages = jsfModuleConfig.isAlwaysKeepMessages();
     }
 
-    protected void saveFacesMessages(@Observes @AfterFacesRequest FacesContext facesContext)
+    //don't use @AfterFacesRequest
+    //there might be an issue if the ServletRequestListener e.g. of OWB gets called earlier
+    protected void saveFacesMessages(@Observes @AfterPhase(JsfPhaseId.RENDER_RESPONSE) PhaseEvent
phaseEvent)
     {
-        if(this.alwaysKeepMessages && !this.lifecyclePhaseInformation.isRenderResponsePhase())
+        if(this.alwaysKeepMessages)
         {
-            Map<String, Object> requestMap = facesContext.getExternalContext().getRequestMap();
+            Map<String, Object> requestMap = phaseEvent.getFacesContext().getExternalContext().getRequestMap();
 
             @SuppressWarnings({"unchecked"})
             List<FacesMessageEntry> facesMessageEntryList =



Mime
View raw message