You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bi...@apache.org on 2006/05/24 07:04:20 UTC

svn commit: r409072 - /tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java

Author: billbarker
Date: Tue May 23 22:04:20 2006
New Revision: 409072

URL: http://svn.apache.org/viewvc?rev=409072&view=rev
Log:
Port RMI fix from 5.5

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

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=409072&r1=409071&r2=409072&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Tue May 23 22:04:20 2006
@@ -98,7 +98,7 @@
  *
  * @author Remy Maucherat
  * @author Craig R. McClanahan
- * @version $Revision: 378251 $ $Date: 2006-02-16 15:19:13 +0100 (jeu., 16 févr. 2006) $
+ * @version $Revision$ $Date: 2006-05-19 19:52:46 -0700 (Fri, 19 May 2006) $
  */
 public class WebappClassLoader
     extends URLClassLoader
@@ -141,6 +141,7 @@
         "javax.servlet.Servlet"                     // Servlet API
     };
 
+
     /**
      * Set of package names which are not allowed to be loaded from a webapp
      * class loader without delegating first.
@@ -511,6 +512,13 @@
         this.loaderDir = new File(workDir, "loader");
     }
 
+     /**
+      * Utility method for use in subclasses.
+      * Must be called before Lifecycle methods to have any effect.
+      */
+     protected void setParentClassLoader(ClassLoader pcl) {
+         parent = pcl;
+     }
 
     // ------------------------------------------------------- Reloader Methods
 
@@ -1064,7 +1072,7 @@
                             && (!(name.endsWith(".class")))) {
                         // Copy binary content to the work directory if not present
                         File resourceFile = new File(loaderDir, name);
-                        url = resourceFile.toURL();
+                        url = getURI(resourceFile);
                     }
                 } catch (Exception e) {
                     // Ignore
@@ -1401,9 +1409,9 @@
             URL[] urls = new URL[length];
             for (i = 0; i < length; i++) {
                 if (i < filesLength) {
-                    urls[i] = getURL(files[i]);
+                    urls[i] = getURL(files[i], true);
                 } else if (i < filesLength + jarFilesLength) {
-                    urls[i] = getURL(jarRealFiles[i - filesLength]);
+                    urls[i] = getURL(jarRealFiles[i - filesLength], true);
                 } else {
                     urls[i] = external[i - filesLength - jarFilesLength];
                 }
@@ -1831,7 +1839,7 @@
         ResourceEntry entry = new ResourceEntry();
         try {
             entry.source = getURI(new File(file, path));
-            entry.codeBase = getURL(new File(file, path));
+            entry.codeBase = getURL(new File(file, path), false);
         } catch (MalformedURLException e) {
             return null;
         }   
@@ -1957,7 +1965,7 @@
 
                     entry = new ResourceEntry();
                     try {
-                        entry.codeBase = getURL(jarRealFiles[i]);
+                        entry.codeBase = getURL(jarRealFiles[i], false);
                         String jarFakeUrl = getURI(jarRealFiles[i]).toString();
                         jarFakeUrl = "jar:" + jarFakeUrl + "!/" + path;
                         entry.source = new URL(jarFakeUrl);
@@ -2274,7 +2282,7 @@
     /**
      * Get URL.
      */
-    protected URL getURL(File file)
+    protected URL getURL(File file, boolean encoded)
         throws MalformedURLException {
 
         File realFile = file;
@@ -2283,7 +2291,11 @@
         } catch (IOException e) {
             // Ignore
         }
-        return realFile.toURL();
+        if(encoded) {
+            return getURI(realFile);
+        } else {
+            return realFile.toURL();
+        }
 
     }
 
@@ -2294,13 +2306,13 @@
     protected URL getURI(File file)
         throws MalformedURLException {
 
+
         File realFile = file;
         try {
             realFile = realFile.getCanonicalFile();
         } catch (IOException e) {
             // Ignore
         }
-
         return realFile.toURI().toURL();
 
     }



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