You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2011/11/14 23:13:33 UTC

svn commit: r1201931 - /tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Author: markt
Date: Mon Nov 14 22:13:32 2011
New Revision: 1201931

URL: http://svn.apache.org/viewvc?rev=1201931&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=52173
Improve Javadoc for delgate attribute of WebappClassLoader
Based on a patch by bmargulies

Modified:
    tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Modified: tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1201931&r1=1201930&r2=1201931&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Mon Nov 14 22:13:32 2011
@@ -85,14 +85,16 @@ import org.apache.tomcat.util.res.String
  * compatible with a normal <code>URLClassLoader</code>, although its internal
  * behavior may be completely different.
  * <p>
- * <strong>IMPLEMENTATION NOTE</strong> - This class loader faithfully follows
- * the delegation model recommended in the specification. The system class
+ * <strong>IMPLEMENTATION NOTE</strong> - By default, this class loader follows
+ * the delegation model required by the specification. The system class
  * loader will be queried first, then the local repositories, and only then
  * delegation to the parent class loader will occur. This allows the web
  * application to override any shared class except the classes from J2SE.
  * Special handling is provided from the JAXP XML parser interfaces, the JNDI
  * interfaces, and the classes from the servlet API, which are never loaded
- * from the webapp repository.
+ * from the webapp repositories. The <code>delegate</code> property
+ * allows an application to modify this behavior to move the parent class loader
+ * ahead of the local repositories.
  * <p>
  * <strong>IMPLEMENTATION NOTE</strong> - Due to limitations in Jasper
  * compilation technology, any repository which contains classes from
@@ -291,7 +293,8 @@ public class WebappClassLoader
      * usual Java2 delegation model)?  If set to <code>false</code>,
      * this class loader will search its own repositories first, and
      * delegate to the parent only if the class or resource is not
-     * found locally.
+     * found locally. Note that the default, <code>false</code>, is
+     * the behavior called for by the servlet specification.
      */
     protected boolean delegate = false;
 
@@ -535,6 +538,14 @@ public class WebappClassLoader
 
     /**
      * Set the "delegate first" flag for this class loader.
+     * If this flag is true, this class loader delegates
+     * to the parent class loader
+     * <strong>before</strong> searching its own repositories, as
+     * in an ordinary (non-servlet) chain of of Java class loaders.
+     * If set to <code>false</code> (the default),
+     * this class loader will search its own repositories first, and
+     * delegate to the parent only if the class or resource is not
+     * found locally, as per the servlet specification.
      *
      * @param delegate The new "delegate first" flag
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org