org.apache.myfaces.trinidad.resource

## Class ClassLoaderResourceLoader

- java.lang.Object
- - org.apache.myfaces.trinidad.resource.ResourceLoader
  - - org.apache.myfaces.trinidad.resource.ClassLoaderResourceLoader

-     public class ClassLoaderResourceLoader
      extends ResourceLoader

  A resource loader implementation which loads resources using the context class loader. The returned resource URL will be null for paths that attempt to access paths outside the root directory by having ".." in the path.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ClassLoaderResourceLoader()` Constructs a new root ClassLoaderResourceLoader.
    `ClassLoaderResourceLoader(ResourceLoader parent)` Constructs a new ClassLoaderResourceLoader with specified parent.
    `ClassLoaderResourceLoader(String rootPackage)` Constructs a new root ClassLoaderResourceLoader with specified top level resource package.
    `ClassLoaderResourceLoader(String rootPackage, ResourceLoader parent)` Constructs a new root ClassLoaderResourceLoader with specified top level resource package and parent resource loader.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected URL` | `findResource(String path)` Finds the resource with the given name.
    `protected ClassLoader` | `getClassLoader()` Returns the ClassLoader to use when looking up resources under the top level package.

    - ### Methods inherited from class org.apache.myfaces.trinidad.resource.ResourceLoader

      `getContentType, getContentType, getNullResourceLoader, getParent, getResource, isCachable`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ClassLoaderResourceLoader

          public ClassLoaderResourceLoader()

      Constructs a new root ClassLoaderResourceLoader.

    - #### ClassLoaderResourceLoader

          public ClassLoaderResourceLoader(ResourceLoader parent)

      Constructs a new ClassLoaderResourceLoader with specified parent.
      Parameters:
        `parent` - the parent resource loader

    - #### ClassLoaderResourceLoader

          public ClassLoaderResourceLoader(String rootPackage)

      Constructs a new root ClassLoaderResourceLoader with specified top level resource package.
      Parameters:
        `rootPackage` - the top level package used to interpret resource paths For example, it could be "META-INF".

    - #### ClassLoaderResourceLoader

          public ClassLoaderResourceLoader(String rootPackage,
                                   ResourceLoader parent)

      Constructs a new root ClassLoaderResourceLoader with specified top level resource package and parent resource loader.
      Parameters:
        `rootPackage` - the top level package used to interpret resource paths
        `parent` - the parent resource loader

  - ### Method Detail

    - #### findResource

          protected URL findResource(String path)
                              throws IOException

      Description copied from class: `ResourceLoader`
      Finds the resource with the given name. Resource loader implementations should override this method to specify where to find resources.
      Overrides:
        `findResource` in class `ResourceLoader`
      Parameters:
        `path` - The resource name
      Returns:
        A `URL` object for reading the resource, or `null` if the resource could not be found
      Throws:
        `IOException`

    - #### getClassLoader

          protected ClassLoader getClassLoader()

      Returns the ClassLoader to use when looking up resources under the top level package. By default, this is the context class loader.
      Returns:
        the ClassLoader used to lookup resources

Copyright © 2001-2016 The Apache Software Foundation. All Rights Reserved.