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, findClass, foundClass, getContext, getName, getPermissions, getResources, isServerClass, isSystemClass, loadAsResource, loadClass, removeClassFileTransformer, removeTransformer, runWithServerClassAccess, setName
-
Methods inherited from class java.net.URLClassLoader
addURL, definePackage, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
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
-
-