tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From slaur...@apache.org
Subject svn commit: r1163802 - in /tomcat: tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java trunk/java/org/apache/catalina/loader/WebappClassLoader.java
Date Wed, 31 Aug 2011 20:35:22 GMT
Author: slaurent
Date: Wed Aug 31 20:35:22 2011
New Revision: 1163802

URL: http://svn.apache.org/viewvc?rev=1163802&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
bug 51741: Eclipse WTP "Serve modules without publishing" broken with tc7, needs patch in
tomcat

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

Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=1163802&r1=1163801&r2=1163802&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Wed Aug 31
20:35:22 2011
@@ -2898,11 +2898,22 @@ public class WebappClassLoader
 
                 // Note : Not getting an exception here means the resource was
                 // found
-                entry = findResourceInternal(files[i], path);
 
                 ResourceAttributes attributes =
                     (ResourceAttributes) resources.getAttributes(fullPath);
                 contentLength = (int) attributes.getContentLength();
+                String canonicalPath = attributes.getCanonicalPath();
+                if (canonicalPath != null) {
+                    // we create the ResourceEntry based on the information returned
+                    // by the DirContext rather than just using the path to the
+                    // repository. This allows to have smart DirContext implementations 
+                    // that "virtualize" the docbase (e.g. Eclipse WTP)
+                    entry = findResourceInternal(new File(canonicalPath), "");
+                } else {
+                    // probably a resource not in the filesystem (e.g. in a
+                    // packaged war)
+                    entry = findResourceInternal(files[i], path);
+                }
                 entry.lastModified = attributes.getLastModified();
 
                 if (resource != null) {

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=1163802&r1=1163801&r2=1163802&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Wed Aug 31 20:35:22
2011
@@ -2898,11 +2898,22 @@ public class WebappClassLoader
 
                 // Note : Not getting an exception here means the resource was
                 // found
-                entry = findResourceInternal(files[i], path);
 
                 ResourceAttributes attributes =
                     (ResourceAttributes) resources.getAttributes(fullPath);
                 contentLength = (int) attributes.getContentLength();
+                String canonicalPath = attributes.getCanonicalPath();
+                if (canonicalPath != null) {
+                    // we create the ResourceEntry based on the information returned
+                    // by the DirContext rather than just using the path to the
+                    // repository. This allows to have smart DirContext implementations 
+                    // that "virtualize" the docbase (e.g. Eclipse WTP)
+                    entry = findResourceInternal(new File(canonicalPath), "");
+                } else {
+                    // probably a resource not in the filesystem (e.g. in a
+                    // packaged war)
+                    entry = findResourceInternal(files[i], path);
+                }
                 entry.lastModified = attributes.getLastModified();
 
                 if (resource != null) {



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


Mime
View raw message