openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1780735 - /openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Date Sat, 28 Jan 2017 19:36:38 GMT
Author: rmannibucau
Date: Sat Jan 28 19:36:38 2017
New Revision: 1780735

URL: http://svn.apache.org/viewvc?rev=1780735&view=rev
Log:
MEECROWAVE-13 ensure OWB is the first request listener

Modified:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java?rev=1780735&r1=1780734&r2=1780735&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Sat Jan 28 19:36:38 2017
@@ -206,7 +206,29 @@ public class Meecrowave implements AutoC
 
 
         final OWBJarScanner scanner = new OWBJarScanner();
-        final StandardContext ctx = new StandardContext();
+        final StandardContext ctx = new StandardContext() {
+            @Override
+            public void setApplicationEventListeners(final Object[] listeners) {
+                if (listeners == null) {
+                    super.setApplicationEventListeners(null);
+                    return;
+                }
+
+                // ensure owb is first and cxf is last otherwise surprises,
+                // if we don't -> no @RequestScoped in request listeners :(
+                for (int i = 1; i < listeners.length; i++) {
+                    if (OWBAutoSetup.EagerBootListener.class.isInstance(listeners[i])) {
+                        final Object first = listeners[0];
+                        listeners[0] = listeners[i];
+                        listeners[i] = first;
+                        break;
+                    }
+                }
+
+                // and finally let it go after our re-ordering
+                super.setApplicationEventListeners(listeners);
+            }
+        };
         ctx.setPath(meta.context);
         ctx.setName(meta.context);
         ctx.setJarScanner(scanner);



Mime
View raw message