public class DefaultTagLibraryResolver extends Object implements TagLibraryResolver
DefaultTagLibraryResolver
is a default implemenation
which attempts to interpret the URI as a String called 'jelly:className'
and class load the given Java class. Otherwise META-INF/services/jelly/uri
is searched for on the thread context's class path and, if found, that
class will be loaded.
Constructor and Description |
---|
DefaultTagLibraryResolver() |
Modifier and Type | Method and Description |
---|---|
ClassLoader |
getClassLoader()
Return the class loader to be used for instantiating application objects
when required.
|
org.apache.commons.discovery.resource.classes.DiscoverClasses |
getDiscoverClasses() |
boolean |
getUseContextClassLoader()
Return the boolean as to whether the context classloader should be used.
|
protected TagLibrary |
loadClass(String uri,
String className)
Instantiates the given class name.
|
protected TagLibrary |
newInstance(String uri,
Class theClass)
Creates a new instance of the given TagLibrary class or
return null if it could not be instantiated.
|
TagLibrary |
resolveTagLibrary(String uri)
Attempts to resolve the given URI to be associated with a TagLibrary
otherwise null is returned to indicate no tag library could be found
so that the namespace URI should be treated as just vanilla XML.
|
void |
setClassLoader(ClassLoader classLoader)
Set the class loader to be used for instantiating application objects
when required.
|
void |
setDiscoverClasses(org.apache.commons.discovery.resource.classes.DiscoverClasses discovery)
Sets the fully configured DiscoverClasses instance to be used to
lookup services
|
void |
setUseContextClassLoader(boolean use)
Determine whether to use the Context ClassLoader (the one found by
calling
Thread.currentThread().getContextClassLoader() )
to resolve/load classes. |
public TagLibrary resolveTagLibrary(String uri)
resolveTagLibrary
in interface TagLibraryResolver
public ClassLoader getClassLoader()
setClassLoader()
, if anyuseContextClassLoader
property is set to truepublic void setClassLoader(ClassLoader classLoader)
classLoader
- The new class loader to use, or null
to revert to the standard rulespublic boolean getUseContextClassLoader()
public void setUseContextClassLoader(boolean use)
Thread.currentThread().getContextClassLoader()
)
to resolve/load classes. If not
using Context ClassLoader, then the class-loading defaults to
using the calling-class' ClassLoader.boolean
- determines whether to use JellyContext ClassLoader.public org.apache.commons.discovery.resource.classes.DiscoverClasses getDiscoverClasses()
public void setDiscoverClasses(org.apache.commons.discovery.resource.classes.DiscoverClasses discovery)
protected TagLibrary loadClass(String uri, String className)
protected TagLibrary newInstance(String uri, Class theClass)
Copyright © 2014 Apache Software Foundation. All rights reserved.