1 7 package org.jboss.web.tomcat.tc5; 8 9 import org.apache.catalina.loader.WebappClassLoader; 10 import org.jboss.logging.Logger; 11 12 20 public class WebAppClassLoader extends WebappClassLoader 21 { 22 static Logger log = Logger.getLogger(WebAppClassLoader.class); 23 private String [] filteredPackages = { 24 "org.apache.commons.logging" 25 }; 26 27 public WebAppClassLoader() 28 { 29 } 30 31 public WebAppClassLoader(ClassLoader parent) 32 { 33 super(parent); 34 } 35 36 public String [] getFilteredPackages() 37 { 38 return filteredPackages; 39 } 40 public void setFilteredPackages(String [] pkgs) 41 { 42 this.filteredPackages = pkgs; 43 } 44 45 53 protected boolean filter(String name) 54 { 55 boolean excludeClass = super.filter(name); 56 if( excludeClass == false ) 57 { 58 int length = filteredPackages != null ? filteredPackages.length : 0; 60 for(int n = 0; n < length; n ++) 61 { 62 String pkg = filteredPackages[n]; 63 if( name.startsWith(pkg) ) 64 { 65 excludeClass = true; 66 break; 67 } 68 } 69 } 70 log.trace("filter name="+name+", exclude="+excludeClass); 71 return excludeClass; 72 } 73 } 74 | Popular Tags |