[utilities COMMIT] /spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicat...

noreply at shibboleth.net noreply at shibboleth.net
Fri May 30 13:41:08 EDT 2014


Author: scantor
Date: Fri May 30 13:41:08 2014
New Revision: 577

URL: http://svn.shibboleth.net/view/utilities?rev=577&view=rev
Log:
Check for file existence, and fall back to classpath otherwise.

Modified:
    spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicationContext.java

Modified: spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicationContext.java
URL: http://svn.shibboleth.net/view/utilities/spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicationContext.java?rev=577&r1=576&r2=577&view=diff
==============================================================================
--- spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicationContext.java (original)
+++ spring-extensions/trunk/src/main/java/net/shibboleth/ext/spring/context/FilesystemGenericApplicationContext.java Fri May 30 13:41:08 2014
@@ -65,14 +65,18 @@
     /**
      * {@inheritDoc}
      * 
-     * Overrides the standard behavior of path-only resources and treats them as file paths.
-     * 
-     * <p>Note that this differs from the ordinary Spring contexts that default to file paths because
+     * <p>Overrides the standard behavior of path-only resources and treats them as file paths if the path
+     * exists. Note that this differs from the ordinary Spring contexts that default to file paths because
      * paths are treated as absolute if they are in fact absolute.</p>
      */
     @Override
     protected Resource getResourceByPath(String path) {
-        return new FileSystemResource(path);
+        final Resource r = new FileSystemResource(path);
+        if (r.exists()) {
+            return r;
+        }
+        
+        return super.getResourceByPath(path);
     }
 
 }



More information about the commits mailing list