Package org.apache.jasper.servlet
Class JasperLoader
- java.lang.Object
-
- java.lang.ClassLoader
-
- java.security.SecureClassLoader
-
- java.net.URLClassLoader
-
- org.apache.jasper.servlet.JasperLoader
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class JasperLoader extends java.net.URLClassLoaderClass loader for loading servlet class files (corresponding to JSP files) and tag handler class files (corresponding to tag files).
-
-
Constructor Summary
Constructors Constructor Description JasperLoader(java.net.URL[] urls, java.lang.ClassLoader parent, java.lang.String packageName, java.security.PermissionCollection permissionCollection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.security.PermissionCollectiongetPermissions(java.security.CodeSource codeSource)Get the Permissions for a CodeSource.java.io.InputStreamgetResourceAsStream(java.lang.String name)Delegate to the parent class loader, falling back to the local repositories if the parent returnsnull.java.lang.Class<?>loadClass(java.lang.String name)Load the class with the specified name.java.lang.Class<?>loadClass(java.lang.String name, boolean resolve)Load the class with the specified name, using the following algorithm until it finds and returns the class.-
Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getURLs, newInstance, newInstance
-
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Method Detail
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name) throws java.lang.ClassNotFoundExceptionLoad the class with the specified name. This method searches for classes in the same manner asloadClass(String, boolean)withfalseas the second argument.- Overrides:
loadClassin classjava.lang.ClassLoader- Parameters:
name- Name of the class to be loaded- Throws:
java.lang.ClassNotFoundException- if the class was not found
-
loadClass
public java.lang.Class<?> loadClass(java.lang.String name, boolean resolve) throws java.lang.ClassNotFoundExceptionLoad the class with the specified name, using the following algorithm until it finds and returns the class. If the class cannot be found, aClassNotFoundExceptionis thrown.- Call
findLoadedClass(String)to check if the class has already been loaded. If it has, the sameClassobject is returned. - If the class is not in the JSP package, call the
loadClass()method of the parent class loader. - Otherwise, call
findClass()to find this class in our locally defined repositories.
resolveflag istrue, this method will then callresolveClass(Class)on the resulting Class object.- Overrides:
loadClassin classjava.lang.ClassLoader- Parameters:
name- Name of the class to be loadedresolve- Iftruethen resolve the class- Throws:
java.lang.ClassNotFoundException- if the class was not found
- Call
-
getResourceAsStream
public java.io.InputStream getResourceAsStream(java.lang.String name)
Delegate to the parent class loader, falling back to the local repositories if the parent returnsnull.- Overrides:
getResourceAsStreamin classjava.net.URLClassLoader- See Also:
ClassLoader.getResourceAsStream(String)
-
getPermissions
public final java.security.PermissionCollection getPermissions(java.security.CodeSource codeSource)
Get the Permissions for a CodeSource. Since this ClassLoader is only used for a JSP page in a web application context, we just return our preset PermissionCollection for the web app context.- Overrides:
getPermissionsin classjava.net.URLClassLoader- Parameters:
codeSource- Code source where the code was loaded from- Returns:
- PermissionCollection for CodeSource
-
-