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.URLClassLoader
Class loader for loading servlet class files (corresponding to JSP files) and tag handler class files (corresponding to tag files).
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,byte[]>
bytecodes
private java.security.CodeSource
codeSource
private java.lang.ClassLoader
parent
private java.security.PermissionCollection
permissionCollection
private java.lang.SecurityManager
securityManager
-
Constructor Summary
Constructors Constructor Description JasperLoader(java.net.URL[] urls, java.lang.ClassLoader parent, java.security.PermissionCollection permissionCollection, java.security.CodeSource codeSource, java.util.Map<java.lang.String,byte[]> bytecodes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Class
findClass(java.lang.String className)
java.security.PermissionCollection
getPermissions(java.security.CodeSource codeSource)
Get the Permissions for a CodeSource.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, searching using the following algorithm until it finds and returns the class.private byte[]
loadClassDataFromFile(java.lang.String fileName)
-
Methods inherited from class java.net.URLClassLoader
addURL, close, 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, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
-
-
-
Field Detail
-
permissionCollection
private java.security.PermissionCollection permissionCollection
-
codeSource
private java.security.CodeSource codeSource
-
parent
private java.lang.ClassLoader parent
-
securityManager
private java.lang.SecurityManager securityManager
-
bytecodes
private java.util.Map<java.lang.String,byte[]> bytecodes
-
-
Method Detail
-
loadClass
public java.lang.Class loadClass(java.lang.String name) throws java.lang.ClassNotFoundException
Load the class with the specified name. This method searches for classes in the same manner asloadClass(String, boolean)
withfalse
as the second argument.- Overrides:
loadClass
in 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.ClassNotFoundException
Load the class with the specified name, searching using the following algorithm until it finds and returns the class. If the class cannot be found, returnsClassNotFoundException
.- Call
findLoadedClass(String)
to check if the class has already been loaded. If it has, the sameClass
object is returned. - If the
delegate
property is set totrue
, call theloadClass()
method of the parent class loader, if any. - Call
findClass()
to find this class in our locally defined repositories. - Call the
loadClass()
method of our parent class loader, if any.
resolve
flag istrue
, this method will then callresolveClass(Class)
on the resulting Class object.- Overrides:
loadClass
in classjava.lang.ClassLoader
- Parameters:
name
- Name of the class to be loadedresolve
- Iftrue
then resolve the class- Throws:
java.lang.ClassNotFoundException
- if the class was not found
- Call
-
findClass
public java.lang.Class findClass(java.lang.String className) throws java.lang.ClassNotFoundException
- Overrides:
findClass
in classjava.net.URLClassLoader
- Throws:
java.lang.ClassNotFoundException
-
loadClassDataFromFile
private byte[] loadClassDataFromFile(java.lang.String fileName)
-
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:
getPermissions
in classjava.net.URLClassLoader
- Parameters:
codeSource
- Code source where the code was loaded from- Returns:
- PermissionCollection for CodeSource
-
-