openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strub...@apache.org
Subject svn commit: r1390151 - /openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
Date Tue, 25 Sep 2012 21:27:04 GMT
Author: struberg
Date: Tue Sep 25 21:27:04 2012
New Revision: 1390151

URL: http://svn.apache.org/viewvc?rev=1390151&view=rev
Log:
OWB-709 also check for WEB-INF/classes/META-INF/beans.xml 

Modified:
    openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java

Modified: openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java?rev=1390151&r1=1390150&r2=1390151&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
(original)
+++ openwebbeans/trunk/webbeans-tomcat6/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java
Tue Sep 25 21:27:04 2012
@@ -38,6 +38,7 @@ import java.beans.PropertyChangeEvent;
 import java.beans.PropertyChangeListener;
 import java.lang.reflect.AccessibleObject;
 import java.lang.reflect.Field;
+import java.net.MalformedURLException;
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -83,7 +84,7 @@ public class ContextLifecycleListener im
                 if (event.getType().equals(Lifecycle.START_EVENT))
                 {
                     ServletContext scontext = context.getServletContext();
-                    URL url = scontext.getResource("/WEB-INF/beans.xml");
+                    URL url = getBeansXml(scontext);
                     if (url != null)
                     {
                         //Registering ELResolver with JSP container
@@ -139,7 +140,7 @@ public class ContextLifecycleListener im
                     }
                     else
                     {
-                        URL url = context.getServletContext().getResource("/WEB-INF/beans.xml");
+                        URL url = getBeansXml(context.getServletContext());
                         if(url != null)
                         {
                             TomcatUtil.inject(listener, loader);   
@@ -162,7 +163,7 @@ public class ContextLifecycleListener im
                         
                         ContextAccessController.setReadOnly(context.getNamingContextListener().getName());
                         
-                        URL url = context.getServletContext().getResource("/WEB-INF/beans.xml");
+                        URL url = getBeansXml(context.getServletContext());
                         if(url != null)
                         {
                             Object[] listeners = context.getApplicationEventListeners();
@@ -374,6 +375,17 @@ public class ContextLifecycleListener im
         }
     }
 
+    private URL getBeansXml(ServletContext scontext) throws MalformedURLException
+    {
+        URL url = scontext.getResource("/WEB-INF/beans.xml");
+        if (url == null)
+        {
+            url = scontext.getResource("/WEB-INF/classes/META-INF/beans.xml");
+        }
+        return url;
+    }
+
+
     protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction<Object>
     {
 



Mime
View raw message