Package org.eclipse.jetty.webapp
Class CachingWebAppClassLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.eclipse.jetty.webapp.WebAppClassLoader
-
- org.eclipse.jetty.webapp.CachingWebAppClassLoader
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,ClassVisibilityChecker
@ManagedObject public class CachingWebAppClassLoader extends WebAppClassLoader
A WebAppClassLoader that cachesgetResource(String)
results. Specifically this ClassLoader caches not found classes and resources, which can greatly increase performance for applications that search for resources.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.jetty.webapp.WebAppClassLoader
WebAppClassLoader.Context
-
-
Constructor Summary
Constructors Constructor Description CachingWebAppClassLoader(java.lang.ClassLoader parent, WebAppClassLoader.Context context)
CachingWebAppClassLoader(WebAppClassLoader.Context context)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCache()
java.net.URL
getResource(java.lang.String name)
Get a resource from the classloader NOTE: this method provides a convenience of hacking off a leading / should one be present.java.lang.Class<?>
loadClass(java.lang.String name)
java.lang.String
toString()
-
Methods inherited from class org.eclipse.jetty.webapp.WebAppClassLoader
addClassFileTransformer, addClassPath, addClassPath, addJars, addTransformer, close, getContext, getName, getPermissions, getResources, isServerClass, isSystemClass, removeClassFileTransformer, removeTransformer, runWithServerClassAccess, setName
-
Methods inherited from class java.net.URLClassLoader
findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getDefinedPackage, getDefinedPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
-
-
-
-
Constructor Detail
-
CachingWebAppClassLoader
public CachingWebAppClassLoader(java.lang.ClassLoader parent, WebAppClassLoader.Context context) throws java.io.IOException
- Throws:
java.io.IOException
-
CachingWebAppClassLoader
public CachingWebAppClassLoader(WebAppClassLoader.Context context) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getResource
public java.net.URL getResource(java.lang.String name)
Description copied from class:WebAppClassLoader
Get a resource from the classloader NOTE: this method provides a convenience of hacking off a leading / should one be present. This is non-standard and it is recommended to not rely on this behavior- Overrides:
getResource
in classWebAppClassLoader
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
- Overrides:
loadClass
in classjava.lang.ClassLoader
- Throws:
java.lang.ClassNotFoundException
-
clearCache
@ManagedOperation public void clearCache()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classWebAppClassLoader
-
-