org.apache.tapestry.util
Class DefaultResourceResolver

java.lang.Object
  extended by org.apache.tapestry.util.DefaultResourceResolver
All Implemented Interfaces:
ognl.ClassResolver, IResourceResolver

public class DefaultResourceResolver
extends Object
implements IResourceResolver

Default implementation of IResourceResolver based around Thread.getContextClassLoader() (which is set by the servlet container).

Since:
2.3
Version:
$Id: DefaultResourceResolver.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Constructor Summary
DefaultResourceResolver()
          Constructs a new instance using Thread.getContextClassLoader().
DefaultResourceResolver(ClassLoader loader)
           
 
Method Summary
 Class classForName(String name, Map map)
          OGNL Support for dynamic class loading.
 Class findClass(String name)
          Invokes Class.forName(java.lang.String, boolean, java.lang.ClassLoader).
 ClassLoader getClassLoader()
          Returns a ClassLoader that can see all the classes the resolver can access.
 URL getResource(String name)
          Forwarded, unchanged, to the class loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResourceResolver

public DefaultResourceResolver()
Constructs a new instance using Thread.getContextClassLoader().


DefaultResourceResolver

public DefaultResourceResolver(ClassLoader loader)
Method Detail

getResource

public URL getResource(String name)
Description copied from interface: IResourceResolver
Forwarded, unchanged, to the class loader. Returns null if the resource is not found.

Specified by:
getResource in interface IResourceResolver

findClass

public Class findClass(String name)
Invokes Class.forName(java.lang.String, boolean, java.lang.ClassLoader).

Specified by:
findClass in interface IResourceResolver
Parameters:
name - the complete class name to locate and load
Returns:
The loaded class
Throws:
ApplicationRuntimeException - if loading the class throws an exception (typically ClassNotFoundException or a security exception)

classForName

public Class classForName(String name,
                          Map map)
                   throws ClassNotFoundException
OGNL Support for dynamic class loading. Simply invokes findClass(String).

Specified by:
classForName in interface ognl.ClassResolver
Throws:
ClassNotFoundException

getClassLoader

public ClassLoader getClassLoader()
Description copied from interface: IResourceResolver
Returns a ClassLoader that can see all the classes the resolver can access.

Specified by:
getClassLoader in interface IResourceResolver
Since:
3.0