tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-1698 restore bean manager in ServletContext attributes merging the duplicated logic
Date Tue, 26 Jan 2016 14:09:16 GMT
Repository: tomee
Updated Branches:
  refs/heads/master 0f8fd20bd -> de0bb45f6


TOMEE-1698 restore bean manager in ServletContext attributes merging the duplicated logic


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/de0bb45f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/de0bb45f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/de0bb45f

Branch: refs/heads/master
Commit: de0bb45f6b6e2b03313a10f0c85a94cea6b52689
Parents: 0f8fd20
Author: Romain Manni-Bucau <rmannibucau@apache.org>
Authored: Tue Jan 26 15:09:01 2016 +0100
Committer: Romain Manni-Bucau <rmannibucau@apache.org>
Committed: Tue Jan 26 15:09:01 2016 +0100

----------------------------------------------------------------------
 .../apache/openejb/cdi/OpenEJBLifecycle.java    |  4 ++
 .../tomee/catalina/TomcatWebAppBuilder.java     | 44 ++++++++------------
 2 files changed, 21 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/de0bb45f/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
b/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
index a718bb8..6b2297a 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/cdi/OpenEJBLifecycle.java
@@ -374,6 +374,10 @@ public class OpenEJBLifecycle implements ContainerLifecycle {
     }
 
     public static void initializeServletContext(final ServletContext servletContext, final
WebBeansContext context) {
+        if (context == null || !context.getBeanManagerImpl().isInUse()) {
+            return;
+        }
+
         final ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
         final ELResolver resolver = elAdaptor.getOwbELResolver();
         //Application is configured as JSP

http://git-wip-us.apache.org/repos/asf/tomee/blob/de0bb45f/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
index 83b8a12..1f0e1cf 100644
--- a/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
+++ b/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatWebAppBuilder.java
@@ -131,9 +131,22 @@ import org.apache.tomee.common.UserTransactionFactory;
 import org.apache.tomee.loader.TomcatHelper;
 import org.apache.webbeans.config.WebBeansContext;
 import org.apache.webbeans.spi.ContextsService;
-import org.apache.webbeans.spi.adaptor.ELAdaptor;
 import org.omg.CORBA.ORB;
 
+import javax.ejb.spi.HandleDelegate;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.naming.StringRefAddr;
+import javax.servlet.ServletContext;
+import javax.servlet.SessionTrackingMode;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.jsp.JspFactory;
+import javax.sql.DataSource;
+import javax.transaction.TransactionManager;
+import javax.transaction.TransactionSynchronizationRegistry;
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
@@ -157,22 +170,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
-import javax.ejb.spi.HandleDelegate;
-import javax.el.ELResolver;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-import javax.naming.NamingException;
-import javax.naming.Reference;
-import javax.naming.StringRefAddr;
-import javax.servlet.ServletContext;
-import javax.servlet.SessionTrackingMode;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.jsp.JspApplicationContext;
-import javax.servlet.jsp.JspFactory;
-import javax.sql.DataSource;
-import javax.transaction.TransactionManager;
-import javax.transaction.TransactionSynchronizationRegistry;
 
 import static java.util.Arrays.asList;
 import static org.apache.tomee.catalina.Contexts.warPath;
@@ -1375,16 +1372,9 @@ public class TomcatWebAppBuilder implements WebAppBuilder, ContextListener,
Pare
                 }
             }
 
-            final JspFactory factory = JspFactory.getDefaultFactory();
-            if (factory != null) {
-                final JspApplicationContext applicationCtx = factory.getJspApplicationContext(standardContext.getServletContext());
-                final WebBeansContext context = appContext.getWebBeansContext();
-                if (context != null && context.getBeanManagerImpl().isInUse()) {
-                    // Registering ELResolver with JSP container
-                    final ELAdaptor elAdaptor = context.getService(ELAdaptor.class);
-                    final ELResolver resolver = elAdaptor.getOwbELResolver();
-                    applicationCtx.addELResolver(resolver);
-                }
+            final WebBeansContext webBeansContext = appContext.getWebBeansContext();
+            if (webBeansContext != null && webBeansContext.getBeanManagerImpl().isInUse())
{
+                OpenEJBLifecycle.initializeServletContext(standardContext.getServletContext(),
webBeansContext);
             }
         }
 


Mime
View raw message