From: slaurent Date: Wed, 31 Aug 2011 20:35:22 +0000 (+0000) Subject: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51741 X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=c196c8cd70c96484e60bd158e450f8ab06a1ffa8;p=tomcat7.0 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 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1163802 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/java/org/apache/catalina/loader/WebappClassLoader.java b/java/org/apache/catalina/loader/WebappClassLoader.java index dbb15a2eb..d94b1a930 100644 --- a/java/org/apache/catalina/loader/WebappClassLoader.java +++ b/java/org/apache/catalina/loader/WebappClassLoader.java @@ -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) {