Package org.apache.batik.script.rhino
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 CodeSource
CodeSource for classes defined by this loaderprotected URL
URL for the document referencing the script.protected AccessControlContext
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 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 PermissionCollection
getPermissions
(CodeSource codesource) Returns the permissions for the given CodeSource object.void
Links the Java class.Methods inherited from class java.net.URLClassLoader
addURL, close, definePackage, findClass, findResource, findResources, getResourceAsStream, getURLs, newInstance, newInstance
Methods inherited from class java.security.SecureClassLoader
defineClass, defineClass
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, 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
Define and load a Java class- Specified by:
defineClass
in interfaceorg.mozilla.javascript.GeneratedClassLoader
-
linkClass
Links the Java class.- Specified by:
linkClass
in 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:
getPermissions
in classURLClassLoader
-