Class ClassLoading
RMIClassLoader with optional
verification that the codebase URLs used to load classes provide content integrity (see Security.verifyCodebaseIntegrity).- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClassloadClass(String codebase, String name, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) Loads a class usingRMIClassLoader.loadClass, optionally verifying that the codebase URLs provide content integrity.static ClassloadProxyClass(String codebase, String[] interfaceNames, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) Loads a dynamic proxy class usingRMIClassLoader.loadProxyClass, optionally verifying that the codebase URLs provide content integrity.
-
Method Details
-
loadClass
public static Class loadClass(String codebase, String name, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) throws MalformedURLException, ClassNotFoundException Loads a class usingRMIClassLoader.loadClass, optionally verifying that the codebase URLs provide content integrity.If
verifyCodebaseIntegrityistrueandcodebaseis notnull, then this method invokesSecurity.verifyCodebaseIntegritywithcodebaseas the first argument andverifierLoaderas the second argument (this invocation may be skipped if a previous invocation of this method orloadProxyClasshas already invokedSecurity.verifyCodebaseIntegritywith the same value ofcodebaseand the same effective value ofverifierLoaderas arguments without it throwing an exception). IfSecurity.verifyCodebaseIntegritythrows aSecurityException, then this method proceeds as ifcodebasewerenull. IfSecurity.verifyCodebaseIntegritythrows any other exception, then this method throws that exception.This method then invokes
RMIClassLoader.loadClasswithcodebaseas the first argument (ornullif in the previous stepSecurity.verifyCodebaseIntegritywas invoked and it threw aSecurityException),nameas the second argument, anddefaultLoaderas the third argument. IfRMIClassLoader.loadClassthrows aClassNotFoundException, then this method throws aClassNotFoundException; ifRMIClassLoader.loadClassthrows any other exception, then this method throws that exception; otherwise, this method returns theClassreturned byRMIClassLoader.loadClass.- Parameters:
codebase- the list of URLs (separated by spaces) to load the class from, ornullname- the name of the class to loaddefaultLoader- the class loader value (possiblynull) to pass as thedefaultLoaderargument toRMIClassLoader.loadClassverifyCodebaseIntegrity- iftrue, verify that the codebase URLs provide content integrityverifierLoader- the class loader value (possiblynull) to pass toSecurity.verifyCodebaseIntegrity, ifverifyCodebaseIntegrityistrue- Returns:
- the
Classobject representing the loaded class - Throws:
MalformedURLException- ifSecurity.verifyCodebaseIntegrityorRMIClassLoader.loadClassthrows aMalformedURLExceptionClassNotFoundException- ifRMIClassLoader.loadClassthrows aClassNotFoundExceptionNullPointerException- ifnameisnull
-
loadProxyClass
public static Class loadProxyClass(String codebase, String[] interfaceNames, ClassLoader defaultLoader, boolean verifyCodebaseIntegrity, ClassLoader verifierLoader) throws MalformedURLException, ClassNotFoundException Loads a dynamic proxy class usingRMIClassLoader.loadProxyClass, optionally verifying that the codebase URLs provide content integrity.If
verifyCodebaseIntegrityistrueandcodebaseis notnull, then this method invokesSecurity.verifyCodebaseIntegritywithcodebaseas the first argument andverifierLoaderas the second argument (this invocation may be skipped if a previous invocation of this method orloadClasshas already invokedSecurity.verifyCodebaseIntegritywith the same value ofcodebaseand the same effective value ofverifierLoaderas arguments without it throwing an exception). IfSecurity.verifyCodebaseIntegritythrows aSecurityException, then this method proceeds as ifcodebasewerenull. IfSecurity.verifyCodebaseIntegritythrows any other exception, then this method throws that exception.This method invokes
RMIClassLoader.loadProxyClasswithcodebaseas the first argument (ornullif in the previous stepSecurity.verifyCodebaseIntegritywas invoked and it threw aSecurityException),interfaceNamesas the second argument, anddefaultLoaderas the third argument. IfRMIClassLoader.loadProxyClassthrows aClassNotFoundException, then this method throws aClassNotFoundException; ifRMIClassLoader.loadProxyClassthrows any other exception, then this method throws that exception; otherwise, this method returns theClassreturned byRMIClassLoader.loadProxyClass.- Parameters:
codebase- the list of URLs (separated by spaces) to load classes from, ornullinterfaceNames- the names of the interfaces for the proxy class to implementdefaultLoader- the class loader value (possiblynull) to pass as thedefaultLoaderargument toRMIClassLoader.loadProxyClassverifyCodebaseIntegrity- iftrue, verify that the codebase URLs provide content integrityverifierLoader- the class loader value (possiblynull) to pass toSecurity.verifyCodebaseIntegrity, ifverifyCodebaseIntegrityistrue- Returns:
- the
Classobject representing the loaded dynamic proxy class - Throws:
MalformedURLException- ifSecurity.verifyCodebaseIntegrityorRMIClassLoader.loadProxyClassthrows aMalformedURLExceptionClassNotFoundException- ifRMIClassLoader.loadProxyClassthrows aClassNotFoundExceptionNullPointerException- ifinterfaceNamesisnullor if any element ofinterfaceNamesisnull
-