[webbeans-commits] Webbeans SVN: r2647 - extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Tue May 5 01:28:53 EDT 2009


Author: dan.j.allen
Date: 2009-05-05 01:28:53 -0400 (Tue, 05 May 2009)
New Revision: 2647

Modified:
   extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/AbstractScanner.java
   extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscovery.java
Log:
WBX-38
resource path should be META-INF/beans.xml rather than /META-INF/beans.xml
use string constants for paths (to avoid mixups in the future)


Modified: extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/AbstractScanner.java
===================================================================
--- extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/AbstractScanner.java	2009-05-05 05:28:00 UTC (rev 2646)
+++ extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/AbstractScanner.java	2009-05-05 05:28:53 UTC (rev 2647)
@@ -31,7 +31,7 @@
  */
 public abstract class AbstractScanner implements Scanner
 {
-   
+
    private static final Log log = Logging.getLog(Scanner.class);
    private final ClassLoader classLoader;
    private final ServletWebBeanDiscovery webBeanDiscovery;
@@ -60,7 +60,7 @@
             log.error("Error loading " + name, e);
          }
       }
-      else if (name.endsWith("beans.xml"))
+      else if (name.equals(ServletWebBeanDiscovery.META_INF_BEANS_XML))
       {
          webBeanDiscovery.getWbUrls().add(url);
       }

Modified: extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscovery.java
===================================================================
--- extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscovery.java	2009-05-05 05:28:00 UTC (rev 2646)
+++ extensions/trunk/servlet/int/src/main/java/org/jboss/webbeans/environment/servlet/discovery/ServletWebBeanDiscovery.java	2009-05-05 05:28:53 UTC (rev 2647)
@@ -39,6 +39,9 @@
  */
 public abstract class ServletWebBeanDiscovery implements WebBeanDiscovery
 {
+   public static final String META_INF_BEANS_XML = "META-INF/beans.xml";
+   public static final String WEB_INF_BEANS_XML = "/WEB-INF/beans.xml";
+   public static final String WEB_INF_CLASSES = "/WEB-INF/classes";
    
    private final Set<Class<?>> wbClasses;
    private final Set<URL> wbUrls;
@@ -75,13 +78,13 @@
    private void scan()
    {
       Scanner scanner = new URLScanner(Reflections.getClassLoader(), this);
-      scanner.scanResources(new String[] { "/META-INF/beans.xml" });
+      scanner.scanResources(new String[] { META_INF_BEANS_XML });
       try
       {
-         URL beans = servletContext.getResource("/WEB-INF/beans.xml");
+         URL beans = servletContext.getResource(WEB_INF_BEANS_XML);
          if (beans != null)
          {
-            File webInfClasses = Servlets.getRealFile(servletContext, "/WEB-INF/classes");
+            File webInfClasses = Servlets.getRealFile(servletContext, WEB_INF_CLASSES);
             if (webInfClasses != null)
             {
                File[] files = { webInfClasses };




More information about the weld-commits mailing list