URL loadResourceDirect( String name ) { // 1. Try this realm's ClassLoader. // 2. If the realm has a parent try the parent's ClassLoader. URL resource = this.classLoader.findResource( name ); if ( resource == null && getParent() != null ) { resource = getParent().getResource( name ); } return resource; }
/** Load a class. * * @param name The name of the class to load. * * @return The loaded class. * * @throws ClassNotFoundException If the class cannot be found. */ Class loadClassDirect( String name ) throws ClassNotFoundException { // 1. Try this realm's ClassLoader. // 2. If the realm has a parent try the parent's ClassLoader. Class clazz = null; try { clazz = this.classLoader.loadClassDirect( name ); } catch ( ClassNotFoundException cnfe1 ) { if ( getParent() != null ) { clazz = getParent().getClassLoader().loadClass( name ); } else { throw cnfe1; } } return clazz; }
for ( Enumeration parent = getParent().findResources(name); parent.hasMoreElements(); )