Package org.keycloak.utils
Class ProxyClassLoader
- java.lang.Object
- 
- java.lang.ClassLoader
- 
- org.keycloak.utils.ProxyClassLoader
 
 
- 
 public class ProxyClassLoader extends ClassLoader - Author:
- Erik Mulder Classloader implementation to facilitate loading classes and resources from a collection of other classloaders. Effectively it forms a proxy to one or more other classloaders. The way it works: - Get list of classloaders, which will be used as "delegates" when loaded classes or resources. - Can be retrived from provided classloaders or alternatively from the provided classes where the "delegate classloaders" will be determined from the classloaders of given classes - For each class or resource that is 'requested': - First try all provided classloaders and if we have a match, return that - If no match was found: proceed with 'normal' classloading in 'current classpath' scope In this particular context: only loadClass and getResource overrides are needed, since those are the methods that a classloading and resource loading process will need.
 
- 
- 
Constructor SummaryConstructors Constructor Description ProxyClassLoader(ClassLoader... delegateClassLoaders)Init classloader with the list of given delegatesProxyClassLoader(Collection<Class<?>> classes)Get all unique classloaders from the provided classes to be used as "Delegate classloaders"
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description URLgetResource(String name)Enumeration<URL>getResources(String name)Class<?>loadClass(String name)StringtoString()- 
Methods inherited from class java.lang.ClassLoaderclearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResourceAsStream, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
- 
 
- 
- 
- 
Constructor Detail- 
ProxyClassLoaderpublic ProxyClassLoader(ClassLoader... delegateClassLoaders) Init classloader with the list of given delegates- Parameters:
- delegateClassLoaders-
 
 - 
ProxyClassLoaderpublic ProxyClassLoader(Collection<Class<?>> classes) Get all unique classloaders from the provided classes to be used as "Delegate classloaders"- Parameters:
- classes-
 
 
- 
 - 
Method Detail- 
loadClasspublic Class<?> loadClass(String name) throws ClassNotFoundException - Overrides:
- loadClassin class- ClassLoader
- Throws:
- ClassNotFoundException
 
 - 
getResourcepublic URL getResource(String name) - Overrides:
- getResourcein class- ClassLoader
 
 - 
getResourcespublic Enumeration<URL> getResources(String name) throws IOException - Overrides:
- getResourcesin class- ClassLoader
- Throws:
- IOException
 
 
- 
 
-