openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1823526 - in /openwebbeans/trunk: webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Date Wed, 07 Feb 2018 22:32:18 GMT
Author: struberg
Date: Wed Feb  7 22:32:18 2018
New Revision: 1823526

URL: http://svn.apache.org/viewvc?rev=1823526&view=rev
Log:
OWB-1229 fire BeforeDestroyed event for RequestScope and ConversationScope

Modified:
    openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
    openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java

Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java?rev=1823526&r1=1823525&r2=1823526&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
(original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/conversation/ConversationManager.java
Wed Feb  7 22:32:18 2018
@@ -31,6 +31,7 @@ import javax.enterprise.context.spi.Cont
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
 
+import org.apache.webbeans.annotation.BeforeDestroyedLiteral;
 import org.apache.webbeans.annotation.DefaultLiteral;
 import org.apache.webbeans.annotation.DestroyedLiteral;
 import org.apache.webbeans.config.OWBLogConst;
@@ -194,7 +195,11 @@ public class ConversationManager
      */
     public void destroyConversationContext(ConversationContext ctx)
     {
+        webBeansContext.getBeanManagerImpl().fireEvent(
+                getLifecycleEventPayload(ctx), BeforeDestroyedLiteral.INSTANCE_CONVERSATION_SCOPED);
+
         ctx.destroy();
+
         webBeansContext.getBeanManagerImpl().fireEvent(
             getLifecycleEventPayload(ctx), DestroyedLiteral.INSTANCE_CONVERSATION_SCOPED);
     }

Modified: openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java?rev=1823526&r1=1823525&r2=1823526&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
(original)
+++ openwebbeans/trunk/webbeans-web/src/main/java/org/apache/webbeans/web/context/WebContextsService.java
Wed Feb  7 22:32:18 2018
@@ -424,6 +424,20 @@ public class WebContextsService extends
 
         }
 
+        Object payload = null;
+        if (shouldFireRequestLifecycleEvents())
+        {
+            if (endObject != null && endObject instanceof ServletRequestEvent)
+            {
+                payload = ((ServletRequestEvent) endObject).getServletRequest();
+            }
+
+            webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
+                    payload != null ? payload : new Object(), BeforeDestroyedLiteral.INSTANCE_REQUEST_SCOPED);
+
+        }
+
+
         context.destroy();
 
         // clean up the EL caches after each request
@@ -435,12 +449,6 @@ public class WebContextsService extends
 
         if (shouldFireRequestLifecycleEvents())
         {
-            Object payload = null;
-
-            if (endObject != null && endObject instanceof ServletRequestEvent)
-            {
-                payload = ((ServletRequestEvent) endObject).getServletRequest();
-            }
             webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent(
                 payload != null ? payload : new Object(), DestroyedLiteral.INSTANCE_REQUEST_SCOPED);
         }
@@ -787,7 +795,8 @@ public class WebContextsService extends
             NotificationManager notificationManager = webBeansContext.getNotificationManager();
             fireRequestLifecycleEvents
                 = notificationManager.hasContextLifecycleObserver(InitializedLiteral.INSTANCE_REQUEST_SCOPED)
||
-                  notificationManager.hasContextLifecycleObserver(DestroyedLiteral.INSTANCE_REQUEST_SCOPED);
+                  notificationManager.hasContextLifecycleObserver(BeforeDestroyedLiteral.INSTANCE_REQUEST_SCOPED)
||
+                  notificationManager.hasContextLifecycleObserver(DestroyedLiteral.INSTANCE_REQUEST_SCOPED)
;
         }
 
         return fireRequestLifecycleEvents;



Mime
View raw message