cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r592181 - /incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
Date Mon, 05 Nov 2007 23:28:49 GMT
Author: dkulp
Date: Mon Nov  5 15:28:44 2007
New Revision: 592181

URL: http://svn.apache.org/viewvc?rev=592181&view=rev
Log:
Allow lookup of URL's for resources loaded from the BusApplicationContextResourceResolver

Modified:
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java?rev=592181&r1=592180&r2=592181&view=diff
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
(original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/bus/spring/BusApplicationContextResourceResolver.java
Mon Nov  5 15:28:44 2007
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.net.URL;
 
 import org.apache.cxf.resource.ResourceResolver;
 
@@ -54,12 +55,23 @@
     public <T> T resolve(String resourceName, Class<T> resourceType) {
         if (resourceName == null) {
             return null;
-        }    
-        try { 
+        }   
+        try {
             return resourceType.cast(context.getBean(resourceName, resourceType));
         } catch (NoSuchBeanDefinitionException def) {
-            return null;
+            //ignore
+        }
+        try {
+            if (URL.class.isAssignableFrom(resourceType)) {
+                Resource r = context.getResource(resourceName);
+                if (r != null && r.exists()) {
+                    return resourceType.cast(r.getURL());
+                }
+            }
+        } catch (IOException e) {
+            //ignore
         }
+        return null;
     }
 
 



Mime
View raw message