Hola Cocooners , Marcianos, y demas habitantes de CoCoon-dev:
With this patch, AFAIK CoCoon can be entirely fitted into a Tomcat
context, with no need to put any jar in the main classpath, i'm right ?
Cocooners, can you try this???
Saludos ,
Ignacio J. Ortega
> -----Mensaje original-----
> De: craigmcc@locus.apache.org [mailto:craigmcc@locus.apache.org]
> Enviado el: viernes 14 de julio de 2000 21:34
> Para: jakarta-tomcat-cvs@apache.org
> Asunto: cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/loader
> AdaptiveClassLoader.java
>
>
> craigmcc 00/07/14 12:34:25
>
> Modified: src/share/org/apache/tomcat/loader
> AdaptiveClassLoader.java
> Log:
> Implement configurable ordering of class loading, per the
> discussion on
> TOMCAT-DEV yesterday and today, and Costin's vote change
> from -1 to -0.
> The following notes apply:
>
> * Added a "trusted" property to AdaptiveClassLoader.
> If trusted = true, the app's local repositories
> (WEB-INF/classes and WEB-INF/lib/*.jar) are searched
> first; otherwise the system class path is searched
> first.
>
> * Default setting for the "trusted" property is false,
> for backwards compatibility. In other words, this
> check-in won't change current ordering behavior.
>
> * There is no external (to ACL) support for configuring
> the "trusted" flag yet. That will added separately.
>
> * This change is not yet posted to the TOMCAT_32 branch;
> only the main branch. It needs evaluation and testing.
>
> * In both modes, all the examples still work and Tomcat
> passes all Watchdog tests.
>
> Revision Changes Path
> 1.10 +91 -17
> jakarta-tomcat/src/share/org/apache/tomcat/loader/AdaptiveClas
> sLoader.java
>
> Index: AdaptiveClassLoader.java
> ===================================================================
> RCS file:
> /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/loader/Ad
> aptiveClassLoader.java,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -u -r1.9 -r1.10
> --- AdaptiveClassLoader.java 2000/06/19 21:53:14 1.9
> +++ AdaptiveClassLoader.java 2000/07/14 19:34:24 1.10
> @@ -118,7 +118,7 @@
> * @author Martin Pool
> * @author Jim Heintz
> * @author <a href="mailto:stefano@apache.org">Stefano
> Mazzocchi</a>
> - * @version $Revision: 1.9 $ $Date: 2000/06/19 21:53:14 $
> + * @version $Revision: 1.10 $ $Date: 2000/07/14 19:34:24 $
> * @see java.lang.ClassLoader
> */
> public class AdaptiveClassLoader extends ClassLoader {
> @@ -165,6 +165,15 @@
> protected ClassLoader parent;
>
> /**
> + * Is the application running under this class loader
> trusted? If so,
> + * we will look at the defined repositories
> <strong>before</strong> we
> + * look to the system class loader. For untrusted
> applications, we
> + * always check the system class loader first.
> + */
> + protected boolean trusted = false;
> +
> +
> + /**
> * Private class used to maintain information about
> the classes that
> * we loaded.
> */
> @@ -272,6 +281,14 @@
> parent=p;
> }
>
> + public boolean isTrusted() {
> + return this.trusted;
> + }
> +
> + public void setTrusted(boolean trusted) {
> + this.trusted = trusted;
> + }
> +
> void log( String s ) {
> System.out.println("AdaptiveClassLoader: " + s );
> }
> @@ -439,7 +456,8 @@
> }
> }
>
> - if (parent != null) {
> + // Attempt to load the class from the parent class
> loader (untrusted case)
> + if (!trusted && (parent != null)) {
> try {
> if( debug>0) log( "loadClass() from parent " + name);
> c = parent.loadClass(name);
> @@ -454,16 +472,18 @@
> }
> }
>
> - // Attempt to load the class from the system
> - if( debug>0) log( "loadClass() from system " + name);
> - try {
> - c = loadSystemClass(name, resolve);
> - if (c != null) {
> - return c;
> - }
> - } catch (Exception e) {
> - c = null;
> - }
> + // Attempt to load the class from the system class
> loader (untrusted case)
> + if (!trusted) {
> + if( debug>0) log( "loadClass() from system " + name);
> + try {
> + c = loadSystemClass(name, resolve);
> + if (c != null) {
> + return c;
> + }
> + } catch (Exception e) {
> + c = null;
> + }
> + }
>
> if( debug>0) log( "loadClass() from local repository " + name);
> // Try to load it from each repository
> @@ -519,6 +539,35 @@
> }
> }
>
> + // Attempt to load the class from the parent class
> loader (trusted case)
> + if (trusted && (parent != null)) {
> + try {
> + if( debug>0) log( "loadClass() from parent " + name);
> + c = parent.loadClass(name);
> + if (c != null) {
> + if (resolve) resolveClass(c);
> + return c;
> + }
> + } catch (ClassNotFoundException e) {
> + c = null;
> + } catch (Exception e) {
> + c = null;
> + }
> + }
> +
> + // Attempt to load the class from the system (trusted case)
> + if (trusted) {
> + if( debug>0) log( "loadClass() from system " + name);
> + try {
> + c = loadSystemClass(name, resolve);
> + if (c != null) {
> + return c;
> + }
> + } catch (Exception e) {
> + c = null;
> + }
> + }
> +
> // If not found in any repository
> throw new ClassNotFoundException(name);
> }
> @@ -660,7 +709,12 @@
> public InputStream getResourceAsStream(String name) {
> // Try to load it from the system class
> if( debug > 0 ) log( "getResourceAsStream() " + name );
> - InputStream s = getSystemResourceAsStream(name);
> + // InputStream s = getSystemResourceAsStream(name);
> + InputStream s = null;
> +
> + // Get this resource from system class loader (untrusted case)
> + if (!trusted && (s == null))
> + s = getSystemResourceAsStream(name);
>
> if (s == null) {
> // Try to find it from every repository
> @@ -685,6 +739,10 @@
> }
> }
>
> + // Get this resource from system class loader (trusted case)
> + if (trusted && (s == null))
> + s= getSystemResourceAsStream(name);
> +
> return s;
> }
>
> @@ -755,14 +813,22 @@
> public URL getResource(String name) {
> if( debug > 0 ) log( "getResource() " + name );
> // First ask the primordial class loader to fetch
> it from the classpath
> - URL u = getSystemResource(name);
> - if (u != null) {
> - return u;
> - }
> + // URL u = getSystemResource(name);
> + // if (u != null) {
> + // return u;
> + // }
>
> if (name == null) {
> return null;
> }
> + URL u = null;
> +
> + // Get this resource from the system class path (untrusted case)
> + if (!trusted && (u == null)) {
> + u = getSystemResource(name);
> + if (u != null)
> + return u;
> + }
>
> // We got here so we have to look for the resource
> in our list of repository elements
> Enumeration repEnum = repository.elements();
> @@ -806,8 +872,16 @@
> }
> }
>
> + // Get this resource from the system class path (trusted case)
> + if (trusted && (u == null)) {
> + u = getSystemResource(name);
> + if (u != null)
> + return u;
> + }
> +
> // Not found
> return null;
> +
> }
>
> public String toString() {
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>
|