Package: org.grails.io.support

## [Java] Class DefaultResourceLoader

- org.grails.io.support.DefaultResourceLoader

- All Implemented Interfaces and Traits:
    ResourceLoader

      public class DefaultResourceLoader
      extends java.lang.Object

  Default implementation of the ResourceLoader interface.

  Will return a UrlResource if the location value is a URL, and a ClassPathResource if it is a non-URL path or a "classpath:" pseudo-URL.

  Authors:
    Juergen Hoeller
  Since:
    10.03.2004

- - ### Constructor Summary

    Constructors
    Constructor and description
    `DefaultResourceLoader ()` Create a new DefaultResourceLoader.
    `DefaultResourceLoader (java.lang.ClassLoader classLoader)` Create a new DefaultResourceLoader.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `java.lang.ClassLoader` | `getClassLoader()` Return the ClassLoader to load class path resources with.
    `` | `static java.lang.ClassLoader` | `getDefaultClassLoader()`
    `` | `Resource` | `getResource(java.lang.String location)`
    `` | `protected Resource` | `getResourceByPath(java.lang.String path)` Return a Resource handle for the resource at the given path.
    `` | `void` | `setClassLoader(java.lang.ClassLoader classLoader)` Specify the ClassLoader to load class path resources with, or `null` for using the thread context class loader at the time of actual resource access.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class java.lang.Object` | `java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()`

- - ### Constructor Detail

    - #### public DefaultResourceLoader()

      Create a new DefaultResourceLoader.

      ClassLoader access will happen using the thread context class loader at the time of this ResourceLoader's initialization.

      See Also:
        java.lang.Thread#getContextClassLoader()

    - #### public DefaultResourceLoader(java.lang.ClassLoader classLoader)

      Create a new DefaultResourceLoader.

      Parameters:
        `classLoader` - the ClassLoader to load class path resources with, or `null` for using the thread context class loader at the time of actual resource access

  - ### Method Detail

    - #### public java.lang.ClassLoader getClassLoader()

      Return the ClassLoader to load class path resources with.

    - #### public static java.lang.ClassLoader getDefaultClassLoader()

    - #### public Resource getResource(java.lang.String location)

    - #### protected Resource getResourceByPath(java.lang.String path)

      Return a Resource handle for the resource at the given path.

      The default implementation supports class path locations. This should be appropriate for standalone implementations but can be overridden, e.g. for implementations targeted at a Servlet container.

      Parameters:
        `path` - the path to the resource
      Returns:
        the corresponding Resource handle
      See Also:
        ClassPathResource

    - #### public void setClassLoader(java.lang.ClassLoader classLoader)

      Specify the ClassLoader to load class path resources with, or `null` for using the thread context class loader at the time of actual resource access.

      The default is that ClassLoader access will happen using the thread context class loader at the time of this ResourceLoader's initialization.