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: [email protected]
For additional commands, e-mail: [email protected]