org.springframework.core.io.support

Class ResourcePatternUtils

  • java.lang.Object
    • org.springframework.core.io.support.ResourcePatternUtils


  • public abstract class ResourcePatternUtils
    extends java.lang.Object
    Utility class for determining whether a given URL is a resource location that can be loaded via a ResourcePatternResolver.

    Callers will usually assume that a location is a relative path if the isUrl(String) method returns false.

    Since:
    1.2.3
    Author:
    Juergen Hoeller
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static ResourcePatternResolver getResourcePatternResolver(ResourceLoader resourceLoader)
      Return a default ResourcePatternResolver for the given ResourceLoader.
      static boolean isUrl(java.lang.String resourceLocation)
      Return whether the given resource location is a URL: either a special "classpath" or "classpath*" pseudo URL or a standard URL.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ResourcePatternUtils

        public ResourcePatternUtils()
    • Method Detail

      • getResourcePatternResolver

        public static ResourcePatternResolver getResourcePatternResolver(@Nullable
                                                                         ResourceLoader resourceLoader)
        Return a default ResourcePatternResolver for the given ResourceLoader.

        This might be the ResourceLoader itself, if it implements the ResourcePatternResolver extension, or a PathMatchingResourcePatternResolver built on the given ResourceLoader.

        Parameters:
        resourceLoader - the ResourceLoader to build a pattern resolver for (may be null to indicate a default ResourceLoader)
        Returns:
        the ResourcePatternResolver
        See Also:
        PathMatchingResourcePatternResolver