1 // ======================================================================== 2 // Copyright (c) 2009 Intalio, Inc. 3 // ------------------------------------------------------------------------ 4 // All rights reserved. This program and the accompanying materials 5 // are made available under the terms of the Eclipse Public License v1.0 6 // and Apache License v2.0 which accompanies this distribution. 7 // The Eclipse Public License is available at 8 // http://www.eclipse.org/legal/epl-v10.html 9 // The Apache License v2.0 is available at 10 // http://www.opensource.org/licenses/apache2.0.php 11 // You may elect to redistribute this code under either of these licenses. 12 // Contributors: 13 // Hugues Malphettes - initial API and implementation 14 // ======================================================================== 15 package org.eclipse.jetty.osgi.boot.internal.jsp; 16 17 import java.net.URL; 18 19 /** 20 * Add a classloader to the 21 * org.apache.jasper.compiler.TldLocatableURLClassloader. Hopefuly not 22 * necessary: still experimenting. 23 * 24 * @see TldLocatableURLClassloader 25 */ 26 public class TldLocatableURLClassloaderWithInsertedJettyClassloader extends TldLocatableURLClassloader 27 { 28 29 private ClassLoader _internalClassLoader; 30 31 /** 32 * 33 * @param osgiClassLoaderParent 34 * The parent classloader 35 * @param internalClassLoader 36 * The classloader that will be at the same level than the 37 * jarsWithTldsInside 38 * @param jarsWithTldsInside 39 * jars that are scanned for tld files. 40 */ 41 public TldLocatableURLClassloaderWithInsertedJettyClassloader(ClassLoader osgiClassLoaderParent, ClassLoader internalClassLoader, URL[] jarsWithTldsInside) 42 { 43 super(osgiClassLoaderParent,jarsWithTldsInside); 44 _internalClassLoader = internalClassLoader; 45 } 46 47 protected Class<?> findClass(String name) throws ClassNotFoundException 48 { 49 try 50 { 51 return super.findClass(name); 52 } 53 catch (ClassNotFoundException cne) 54 { 55 if (_internalClassLoader != null) 56 { 57 return _internalClassLoader.loadClass(name); 58 } 59 else 60 { 61 throw cne; 62 } 63 } 64 } 65 }