Class RhinoClassLoader
java.lang.Object
java.lang.ClassLoader
java.security.SecureClassLoader
java.net.URLClassLoader
org.apache.batik.script.rhino.RhinoClassLoader
- All Implemented Interfaces:
Closeable, AutoCloseable, org.mozilla.javascript.GeneratedClassLoader
public class RhinoClassLoader
extends URLClassLoader
implements org.mozilla.javascript.GeneratedClassLoader
This class loader implementation will work whether or not the
documentURL is null.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CodeSourceCodeSource for classes defined by this loaderprotected URLURL for the document referencing the script.protected AccessControlContextThe AccessControlContext which can be associated with code loaded by this class loader if it was running stand-alone (i.e., not invoked by code with lesser priviledges). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefineClass(String name, byte[] data) Define and load a Java classReturns the AccessControlContext which should be associated with RhinoCode.protected PermissionCollectiongetPermissions(CodeSource codesource) Returns the permissions for the given CodeSource object.voidLinks the Java class.Methods inherited from class URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstanceMethods inherited from class SecureClassLoader
defineClass, defineClassMethods inherited from class 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, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
documentURL
URL for the document referencing the script. -
codeSource
CodeSource for classes defined by this loader -
rhinoAccessControlContext
The AccessControlContext which can be associated with code loaded by this class loader if it was running stand-alone (i.e., not invoked by code with lesser priviledges).
-
-
Constructor Details
-
RhinoClassLoader
Constructor.- Parameters:
documentURL- the URL from which to load classes and resourcesparent- the parent class loader for delegation
-
-
Method Details
-
defineClass
-
linkClass
Links the Java class.- Specified by:
linkClassin interfaceorg.mozilla.javascript.GeneratedClassLoader
-
getAccessControlContext
Returns the AccessControlContext which should be associated with RhinoCode. -
getPermissions
Returns the permissions for the given CodeSource object. Compared to URLClassLoader, this adds a FilePermission so that files under the same root directory as the document can be read.- Overrides:
getPermissionsin classURLClassLoader
-