Class DefaultResourceLocator

  • All Implemented Interfaces:
    PluginManagerAware, ResourceLocator, org.springframework.beans.factory.Aware, org.springframework.context.ResourceLoaderAware

    public class DefaultResourceLocator
    extends java.lang.Object
    implements ResourceLocator, org.springframework.context.ResourceLoaderAware, PluginManagerAware
    Default ResourceLocator implementation that doesn't take into account servlet loading.
    Since:
    2.0
    • Field Detail

      • FILE_SEPARATOR

        public static final java.lang.String FILE_SEPARATOR
      • NULL_RESOURCE

        protected static final org.springframework.core.io.Resource NULL_RESOURCE
      • patchMatchingResolver

        protected org.springframework.core.io.support.PathMatchingResourcePatternResolver patchMatchingResolver
      • classSearchDirectories

        protected java.util.List<java.lang.String> classSearchDirectories
      • resourceSearchDirectories

        protected java.util.List<java.lang.String> resourceSearchDirectories
      • classNameToResourceCache

        protected java.util.Map<java.lang.String,​org.springframework.core.io.Resource> classNameToResourceCache
      • uriToResourceCache

        protected java.util.Map<java.lang.String,​org.springframework.core.io.Resource> uriToResourceCache
      • defaultResourceLoader

        protected org.springframework.core.io.ResourceLoader defaultResourceLoader
      • warDeployed

        protected boolean warDeployed
    • Constructor Detail

      • DefaultResourceLocator

        public DefaultResourceLocator()
    • Method Detail

      • setSearchLocation

        public void setSearchLocation​(java.lang.String searchLocation)
        Description copied from interface: ResourceLocator
        The basic location from which to conduct the search. At development time this is the base directory, during production this would be the servlet root
        Specified by:
        setSearchLocation in interface ResourceLocator
        Parameters:
        searchLocation - The search location
      • getDefaultResourceLoader

        protected org.springframework.core.io.ResourceLoader getDefaultResourceLoader()
      • setSearchLocations

        public void setSearchLocations​(java.util.Collection<java.lang.String> searchLocations)
        Description copied from interface: ResourceLocator
        Multiple locations to search. See #setSearchLocation
        Specified by:
        setSearchLocations in interface ResourceLocator
        Parameters:
        searchLocations - The locations to search
      • findResourceForURI

        public org.springframework.core.io.Resource findResourceForURI​(java.lang.String uri)
        Description copied from interface: ResourceLocator
        Finds a resource for the given URI
        Specified by:
        findResourceForURI in interface ResourceLocator
        Parameters:
        uri - The URI
        Returns:
        The resource or null if it doesn't exist
      • findResourceInBinaryPlugins

        protected org.springframework.core.io.Resource findResourceInBinaryPlugins​(org.grails.core.io.DefaultResourceLocator.PluginResourceInfo info)
      • findResourceForClassName

        public org.springframework.core.io.Resource findResourceForClassName​(java.lang.String className)
        Description copied from interface: ResourceLocator
        Finds the .groovy file or .java file for a given class from a Grails project. Note that this method will return null in production since sources are not packaged unless an appropriate search location is specified to locate the resource
        Specified by:
        findResourceForClassName in interface ResourceLocator
        Parameters:
        className - The class name
        Returns:
        The resource or null
      • setResourceLoader

        public void setResourceLoader​(org.springframework.core.io.ResourceLoader resourceLoader)
        Specified by:
        setResourceLoader in interface org.springframework.context.ResourceLoaderAware