org.apache.myfaces.trinidad.resource

## Class DynamicResourceLoader

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

- Direct Known Subclasses:
    AggregatingResourceLoader, StringContentResourceLoader

      public abstract class DynamicResourceLoader
      extends ResourceLoader

  A Dynamic Resource Loader that is capable of agregation and dynamic content via custom URLConnection objects.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DynamicResourceLoader(String path)` Creates a DynamicResourceLoader for a specified path.
    `DynamicResourceLoader(String path, ResourceLoader parent)` Creates a CompositeResouceLoader for a specified path.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected URL` | `findResource(String path)` Finds a resource.
    `protected abstract URL` | `getURL(String path)` Returns a URL to this resource.

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

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

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

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

- - ### Constructor Detail

    - #### DynamicResourceLoader

          public DynamicResourceLoader(String path)

      Creates a DynamicResourceLoader for a specified path. The dynamic resource loader will only respond to the specified path when findResource is executed with the same path. If it is not the same, findResource will TRY to redirect the request to the parent if one is provided. The parent ResourceLoader for this constructor is `null`
      Parameters:
        `path` - the path that this ResourceLoader will respond to

    - #### DynamicResourceLoader

          public DynamicResourceLoader(String path,
                               ResourceLoader parent)

      Creates a CompositeResouceLoader for a specified path. The dynamic resource loader will only respond to the specified path when findResource is executed with the same path. If it is not the same, findResource will TRY to redirect the request to the parent if one is provided.
      Parameters:
        `path` - the path that this ResourceLoader will respond to
        `parent` - the parent resource loader

  - ### Method Detail

    - #### findResource

          protected URL findResource(String path)
                              throws IOException

      Finds a resource. If the path does not match the path that this object was constructed with then it will direct the request to the base ResourceLoader. If the path is the same, it calls the getURL method.
      Overrides:
        `findResource` in class `ResourceLoader`
      Parameters:
        `path` - the path which the ResourceLoader is looking for.
      Returns:
        a URL for this resource
      Throws:
        `IOException` - when something bad happens

    - #### getURL

          protected abstract URL getURL(String path)
                                 throws IOException

      Returns a URL to this resource. This URL should have a valid connection.'
      Parameters:
        `path` - the path of the findResourceCall
      Returns:
        a url for this Resource
      Throws:
        `IOException` - when something bad happens

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