org.apache.myfaces.trinidad.resource
Class RegexResourceLoader

java.lang.Object
  extended by org.apache.myfaces.trinidad.resource.ResourceLoader
      extended by org.apache.myfaces.trinidad.resource.RegexResourceLoader

public class RegexResourceLoader
extends ResourceLoader

A resource loader implementation which loads resources by pattern matching the requested resource path to a registered resource loader. Change history 2006-08-01: -= Simon Lessard =- Changed to use a list of entry rather than a dual typed one to add more type safety with minimal memory overhaul and get a really small performance gain.


Constructor Summary
RegexResourceLoader()
          Creates a new RegexResourceLoader.
 
Method Summary
protected  void deregister(String regex)
          Deregisters a resource loader by regular expression.
protected  URL findResource(String path)
          Finds the resource with the given name.
protected  void register(String regex, ResourceLoader loader)
          Registers a resource loader by regular expression.
 
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

RegexResourceLoader

public RegexResourceLoader()
Creates a new RegexResourceLoader.

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

register

protected void register(String regex,
                        ResourceLoader loader)
Registers a resource loader by regular expression.

Parameters:
regex - the regular expression to match
loader - the resource loader to use for matching paths

deregister

protected void deregister(String regex)
Deregisters a resource loader by regular expression.

Parameters:
regex - the regular expression to remove


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