1 16 17 package org.springframework.core.io.support; 18 19 import org.springframework.core.io.ResourceLoader; 20 import org.springframework.util.Assert; 21 import org.springframework.util.ResourceUtils; 22 23 35 public abstract class ResourcePatternUtils { 36 37 45 public static boolean isUrl(String resourceLocation) { 46 if (resourceLocation.startsWith(ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX)) { 47 return true; 48 } 49 return ResourceUtils.isUrl(resourceLocation); 50 } 51 52 62 public static ResourcePatternResolver getResourcePatternResolver(ResourceLoader resourceLoader) { 63 Assert.notNull(resourceLoader, "ResourceLoader must not be null"); 64 if (resourceLoader instanceof ResourcePatternResolver) { 65 return (ResourcePatternResolver) resourceLoader; 66 } 67 else { 68 return new PathMatchingResourcePatternResolver(resourceLoader); 69 } 70 } 71 72 } 73 | Popular Tags |