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:
java.io.Closeable,java.lang.AutoCloseable,org.mozilla.javascript.GeneratedClassLoader
public class RhinoClassLoader extends java.net.URLClassLoader implements org.mozilla.javascript.GeneratedClassLoaderThis class loader implementation will work whether or not the documentURL is null.- Version:
- $Id: RhinoClassLoader.java 1733416 2016-03-03 07:07:13Z gadams $
-
-
Field Summary
Fields Modifier and Type Field Description protected java.security.CodeSourcecodeSourceCodeSource for classes defined by this loaderprotected java.net.URLdocumentURLURL for the document referencing the script.protected java.security.AccessControlContextrhinoAccessControlContextThe 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 Constructor Description RhinoClassLoader(java.net.URL documentURL, java.lang.ClassLoader parent)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassdefineClass(java.lang.String name, byte[] data)Define and load a Java classjava.security.AccessControlContextgetAccessControlContext()Returns the AccessControlContext which should be associated with RhinoCode.protected java.security.PermissionCollectiongetPermissions(java.security.CodeSource codesource)Returns the permissions for the given CodeSource object.(package private) static java.net.URL[]getURL(java.lang.ClassLoader parent)Helper, returns the URL array from the parent loadervoidlinkClass(java.lang.Class clazz)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.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 Detail
-
documentURL
protected java.net.URL documentURL
URL for the document referencing the script.
-
codeSource
protected java.security.CodeSource codeSource
CodeSource for classes defined by this loader
-
rhinoAccessControlContext
protected java.security.AccessControlContext 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).
-
-
Method Detail
-
getURL
static java.net.URL[] getURL(java.lang.ClassLoader parent)
Helper, returns the URL array from the parent loader
-
defineClass
public java.lang.Class defineClass(java.lang.String name, byte[] data)Define and load a Java class- Specified by:
defineClassin interfaceorg.mozilla.javascript.GeneratedClassLoader
-
linkClass
public void linkClass(java.lang.Class clazz)
Links the Java class.- Specified by:
linkClassin interfaceorg.mozilla.javascript.GeneratedClassLoader
-
getAccessControlContext
public java.security.AccessControlContext getAccessControlContext()
Returns the AccessControlContext which should be associated with RhinoCode.
-
getPermissions
protected java.security.PermissionCollection getPermissions(java.security.CodeSource codesource)
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 classjava.net.URLClassLoader
-
-