You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sl...@apache.org on 2011/12/02 21:49:52 UTC
svn commit: r1209686 [1/2] - in /tomcat/trunk:
java/org/apache/catalina/core/ java/org/apache/catalina/loader/
java/org/apache/catalina/startup/ java/org/apache/naming/resources/
test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Author: slaurent
Date: Fri Dec 2 20:49:50 2011
New Revision: 1209686
URL: http://svn.apache.org/viewvc?rev=1209686&view=rev
Log:
bug 51741: Eclipse WTP "Serve modules without publishing" broken with
tc7, needs patch in tomcat
https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
Added:
tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java (with props)
tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java (with props)
tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties (with props)
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc2/
tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc2/resourceJ.properties (with props)
Modified:
tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java
tomcat/trunk/webapps/docs/config/context.xml
tomcat/trunk/webapps/docs/config/resources.xml
Modified: tomcat/trunk/java/org/apache/catalina/core/StandardContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/StandardContext.java?rev=1209686&r1=1209685&r2=1209686&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/core/StandardContext.java (original)
+++ tomcat/trunk/java/org/apache/catalina/core/StandardContext.java Fri Dec 2 20:49:50 2011
@@ -1177,6 +1177,19 @@ public class StandardContext extends Con
}
}
+ /**
+ * Add a URL for a JAR that contains static resources in a
+ * META-INF/resources directory that should be included in the static
+ * resources for this context.
+ */
+ public void addResourcesDirContext(DirContext altDirContext) {
+ if (webappResources instanceof BaseDirContext) {
+ ((BaseDirContext) webappResources).addAltDirContext(altDirContext);
+ } else {
+ log.error(sm.getString("standardContext.noResourceJar", altDirContext,
+ getName()));
+ }
+ }
/**
* Set the current alias configuration. The list of aliases should be of the
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=1209686&r1=1209685&r2=1209686&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java (original)
+++ tomcat/trunk/java/org/apache/catalina/loader/WebappClassLoader.java Fri Dec 2 20:49:50 2011
@@ -46,11 +46,11 @@ import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.ResourceBundle;
import java.util.Set;
-import java.util.Vector;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.jar.Attributes;
import java.util.jar.Attributes.Name;
@@ -1278,7 +1278,8 @@ public class WebappClassLoader
if (log.isDebugEnabled())
log.debug(" findResources(" + name + ")");
- Vector<URL> result = new Vector<URL>();
+ //we use a LinkedHashSet instead of a Vector to avoid duplicates with virtualmappings
+ LinkedHashSet<URL> result = new LinkedHashSet<URL>();
int jarFilesLength = jarFiles.length;
int repositoriesLength = repositories.length;
@@ -1291,7 +1292,7 @@ public class WebappClassLoader
Enumeration<URL> otherResourcePaths = super.findResources(name);
while (otherResourcePaths.hasMoreElements()) {
- result.addElement(otherResourcePaths.nextElement());
+ result.add(otherResourcePaths.nextElement());
}
}
@@ -1303,7 +1304,7 @@ public class WebappClassLoader
// Note : Not getting an exception here means the resource was
// found
try {
- result.addElement(getURI(new File(files[i], name)));
+ result.add(getURI(new File(files[i], name)));
} catch (MalformedURLException e) {
// Ignore
}
@@ -1321,7 +1322,7 @@ public class WebappClassLoader
try {
String jarFakeUrl = getURI(jarRealFiles[i]).toString();
jarFakeUrl = "jar:" + jarFakeUrl + "!/" + name;
- result.addElement(new URL(jarFakeUrl));
+ result.add(new URL(jarFakeUrl));
} catch (MalformedURLException e) {
// Ignore
}
@@ -1336,12 +1337,24 @@ public class WebappClassLoader
Enumeration<URL> otherResourcePaths = super.findResources(name);
while (otherResourcePaths.hasMoreElements()) {
- result.addElement(otherResourcePaths.nextElement());
+ result.add(otherResourcePaths.nextElement());
}
}
+
+ final Iterator<URL> iterator = result.iterator();
- return result.elements();
+ return new Enumeration<URL>() {
+ @Override
+ public boolean hasMoreElements() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public URL nextElement() {
+ return iterator.next();
+ }
+ };
}
Modified: tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java?rev=1209686&r1=1209685&r2=1209686&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java (original)
+++ tomcat/trunk/java/org/apache/catalina/startup/ContextConfig.java Fri Dec 2 20:49:50 2011
@@ -46,6 +46,9 @@ import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
+import javax.naming.Binding;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.annotation.HandlesTypes;
@@ -79,6 +82,7 @@ import org.apache.catalina.util.ContextN
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.apache.naming.resources.DirContextURLConnection;
+import org.apache.naming.resources.FileDirContext;
import org.apache.naming.resources.ResourceAttributes;
import org.apache.tomcat.JarScanner;
import org.apache.tomcat.JarScannerCallback;
@@ -1197,14 +1201,21 @@ public class ContextConfig
// Step 4. Process /WEB-INF/classes for annotations
// This will add any matching classes to the typeInitializerMap
if (ok) {
- URL webinfClasses;
try {
- webinfClasses = context.getServletContext().getResource(
- "/WEB-INF/classes");
- processAnnotationsUrl(webinfClasses, webXml);
- } catch (MalformedURLException e) {
+ NamingEnumeration<Binding> listBindings =
+ context.getResources().listBindings("/WEB-INF/classes");
+ while (listBindings.hasMoreElements()) {
+ Binding binding = listBindings.nextElement();
+ if (binding.getObject() instanceof FileDirContext) {
+ File webInfCLassDir =
+ new File(
+ ((FileDirContext) binding.getObject()).getDocBase());
+ processAnnotationsFile(webInfCLassDir, webXml);
+ }
+ }
+ } catch (NamingException e) {
log.error(sm.getString(
- "contextConfig.webinfClassesUrl"), e);
+ "contextConfig.webinfClassesUrl"), e);
}
}
@@ -1567,10 +1578,25 @@ public class ContextConfig
if (jar.entryExists("META-INF/resources/")) {
context.addResourceJarUrl(url);
}
+ } else if ("file".equals(url.getProtocol())) {
+ FileDirContext fileDirContext = new FileDirContext();
+ fileDirContext.setDocBase(new File(url.toURI()).getAbsolutePath());
+ try {
+ fileDirContext.lookup("META-INF/resources/");
+ //lookup succeeded
+ if(context instanceof StandardContext){
+ ((StandardContext)context).addResourcesDirContext(fileDirContext);
+ }
+ } catch (NamingException e) {
+ //not found, ignore
+ }
}
} catch (IOException ioe) {
log.error(sm.getString("contextConfig.resourceJarFail", url,
context.getName()));
+ } catch (URISyntaxException e) {
+ log.error(sm.getString("contextConfig.resourceJarFail", url,
+ context.getName()));
} finally {
if (jar != null) {
jar.close();
Modified: tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java?rev=1209686&r1=1209685&r2=1209686&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java (original)
+++ tomcat/trunk/java/org/apache/naming/resources/VirtualDirContext.java Fri Dec 2 20:49:50 2011
@@ -18,70 +18,69 @@ package org.apache.naming.resources;
import java.io.File;
import java.util.ArrayList;
-import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
+import org.apache.catalina.loader.VirtualWebappLoader;
import org.apache.naming.NamingEntry;
/**
- * Extended FileDirContext implementation that will allow loading of tld files
- * from the META-INF directory (or subdirectories) in classpath. This will fully
- * mimic the behavior of compressed jars also when using unjarred resources. Tld
- * files can be loaded indifferently from WEB-INF webapp dir (or subdirs) or
- * from META-INF dir from jars available in the classpath: using this DirContext
- * implementation you will be able to use unexpanded jars during development and
- * to make any tld in them virtually available to the webapp.
- *
+ * Extended FileDirContext implementation that allows to expose multiple
+ * directories of the filesystem under a single webapp, a feature mainly used
+ * for development with IDEs.
+ * This should be used in conjunction with {@link VirtualWebappLoader}.
+ *
* Sample context xml configuration:
- *
+ *
* <code>
- * <Context docBase="\webapps\mydocbase">
+ * <Context path="/mywebapp" docBase="/Users/theuser/mywebapp/src/main/webapp" >
* <Resources className="org.apache.naming.resources.VirtualDirContext"
- * virtualClasspath="\dir\classes;\somedir\somejar.jar"/>
- * </Resources>
+ * extraResourcePaths="/pictures=/Users/theuser/mypictures,/movies=/Users/theuser/mymovies" />
+ * <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
+ * virtualClasspath="/Users/theuser/mywebapp/target/classes" />
+ * <JarScanner scanAllDirectories="true" />
+ * </Context>
* </code>
- *
- *
+ *
+ *
* <strong>This is not meant to be used for production.
* Its meant to ease development with IDE's without the
* need for fully republishing jars in WEB-INF/lib</strong>
- *
- *
+ *
+ *
* @author Fabrizio Giustina
* @version $Id$
*/
public class VirtualDirContext extends FileDirContext {
+ private String extraResourcePaths = "";
+ private Map<String, List<String>> mappedResourcePaths;
/**
- * Map containing generated virtual names for tld files under WEB-INF and
- * the actual file reference.
+ * <p>
+ * Allows to map a path of the filesystem to a path in the webapp. Multiple
+ * filesystem paths can be mapped to the same path in the webapp. Filesystem
+ * path and virtual path must be separated by an equal sign. Pairs of paths
+ * must be separated by a comma.
+ * </p>
+ * Example: <code>
+ * /=/Users/slaurent/mywebapp/src/main/webapp;/pictures=/Users/slaurent/sharedpictures
+ * </code>
+ * <p>
+ * The path to the docBase must not be added here, otherwise resources would
+ * be listed twice.
+ * </p>
+ *
+ * @param path
*/
- private Map<String, File> virtualMappings;
-
- /**
- * Map containing a mapping for tag files that should be loaded from the
- * META-INF dir of referenced jar files.
- */
- private Map<String, File> tagfileMappings;
-
- /**
- * <code>;</code> separated list of virtual path elements.
- */
- private String virtualClasspath;
-
- /**
- * <code>virtualClasspath</code> attribute that will be automatically set
- * from the <code>Context</code> <code>virtualClasspath</code> attribute
- * from the context xml file.
- * @param path <code>;</code> separated list of path elements.
- */
- public void setVirtualClasspath(String path) {
- virtualClasspath = path;
+ public void setExtraResourcePaths(String path) {
+ extraResourcePaths = path;
}
/**
@@ -91,19 +90,39 @@ public class VirtualDirContext extends F
public void allocate() {
super.allocate();
- virtualMappings = new Hashtable<String, File>();
- tagfileMappings = new Hashtable<String, File>();
-
- // looks into any META-INF dir found in classpath entries for tld files.
- StringTokenizer tkn = new StringTokenizer(virtualClasspath, ";");
+ mappedResourcePaths = new HashMap<String, List<String>>();
+ StringTokenizer tkn = new StringTokenizer(extraResourcePaths, ",");
while (tkn.hasMoreTokens()) {
- File file = new File(tkn.nextToken(), "META-INF");
+ String resSpec = tkn.nextToken();
+ if (resSpec.length() > 0) {
+ int idx = resSpec.indexOf('=');
+ String path;
+ if (idx <= 0) {
+ path = "";
+ }
+ else {
+ if (resSpec.startsWith("/=")) {
+ resSpec = resSpec.substring(1);
+ idx--;
+ }
+ path = resSpec.substring(0, idx);
+ }
+ String dir = resSpec.substring(idx + 1);
+ List<String> resourcePaths = mappedResourcePaths.get(path);
+ if (resourcePaths == null) {
+ resourcePaths = new ArrayList<String>();
+ mappedResourcePaths.put(path, resourcePaths);
+ }
+ resourcePaths.add(dir);
- if (!file.exists() || !file.isDirectory()) {
- continue;
+ // Set allowLinking since there can be no canonical path
+ setAllowLinking(true);
}
- scanForTlds(file);
}
+ if (mappedResourcePaths.isEmpty()) {
+ mappedResourcePaths = null;
+ }
+
}
/**
@@ -111,48 +130,124 @@ public class VirtualDirContext extends F
*/
@Override
public void release() {
+ mappedResourcePaths = null;
+
super.release();
- virtualMappings = null;
}
@Override
public Attributes getAttributes(String name) throws NamingException {
- // handle "virtual" tlds
- if (name.startsWith("/WEB-INF/") && name.endsWith(".tld")) {
- String tldName = name.substring(name.lastIndexOf("/") + 1);
- if (virtualMappings.containsKey(tldName)) {
- return new FileResourceAttributes(virtualMappings.get(tldName));
- }
- } else if (name.startsWith("/META-INF/tags") && name.endsWith(".tag")
- || name.endsWith(".tagx")) {
+ NamingException initialException;
+ try {
+ // first try the normal processing, if it fails try with extra
+ // resources
+ Attributes attributes = super.getAttributes(name);
+ return attributes;
+ } catch (NamingException exc) {
+ initialException = exc;
+ }
- // already loaded tag file
- if (tagfileMappings.containsKey(name)) {
- return new FileResourceAttributes(tagfileMappings.get(name));
+ if (mappedResourcePaths != null) {
+ for (Map.Entry<String, List<String>> mapping : mappedResourcePaths.entrySet()) {
+ String path = mapping.getKey();
+ List<String> dirList = mapping.getValue();
+ String resourcesDir = dirList.get(0);
+ if (name.equals(path)) {
+ File f = new File(resourcesDir);
+ if (f.exists() && f.canRead()) {
+ return new FileResourceAttributes(f);
+ }
+ }
+ path += "/";
+ if (name.startsWith(path)) {
+ String res = name.substring(path.length());
+ File f = new File(resourcesDir + "/" + res);
+ if (f.exists() && f.canRead()) {
+ return new FileResourceAttributes(f);
+ }
+ }
}
+ }
+ throw initialException;
+ }
- // unknown tagfile, search for it in virtualClasspath
- StringTokenizer tkn = new StringTokenizer(virtualClasspath, ";");
- while (tkn.hasMoreTokens()) {
- File file = new File(tkn.nextToken(), name);
- if (file.exists()) {
- tagfileMappings.put(name, file);
- return new FileResourceAttributes(file);
+ @Override
+ protected File file(String name) {
+ File file = super.file(name);
+ if (file != null || mappedResourcePaths == null) {
+ return file;
+ }
+ // If not found under docBase, try our other resources
+ // Ensure name string begins with a slash
+ if (name.length() > 0 && name.charAt(0) != '/') {
+ name = "/" + name;
+ }
+ for (Map.Entry<String, List<String>> mapping : mappedResourcePaths.entrySet()) {
+ String path = mapping.getKey();
+ List<String> dirList = mapping.getValue();
+ if (name.equals(path)) {
+ for (String resourcesDir : dirList) {
+ file = new File(resourcesDir);
+ if (file.exists() && file.canRead()) {
+ return file;
+ }
+ }
+ }
+ if (name.startsWith(path + "/")) {
+ String res = name.substring(path.length());
+ for (String resourcesDir : dirList) {
+ file = new File(resourcesDir, res);
+ if (file.exists() && file.canRead()) {
+ return file;
+ }
}
}
}
-
- return super.getAttributes(name);
+ return null;
}
@Override
protected List<NamingEntry> list(File file) {
List<NamingEntry> entries = super.list(file);
- // adds virtual tlds for WEB-INF listing
- if ("WEB-INF".equals(file.getName())) {
- entries.addAll(getVirtualNamingEntries());
+ if (mappedResourcePaths != null && !mappedResourcePaths.isEmpty()) {
+ Set<String> entryNames = new HashSet<String>(entries.size());
+ for (NamingEntry entry : entries) {
+ entryNames.add(entry.name);
+ }
+ // Add appropriate entries from the extra resource paths
+ String absPath = file.getAbsolutePath();
+ if (absPath.startsWith(getDocBase() + File.separator)) {
+ String relPath = absPath.substring(getDocBase().length());
+ String fsRelPath = relPath.replace(File.separatorChar, '/');
+ for (Map.Entry<String, List<String>> mapping : mappedResourcePaths.entrySet()) {
+ String path = mapping.getKey();
+ List<String> dirList = mapping.getValue();
+ String res = null;
+ if (fsRelPath.equals(path)) {
+ res = "";
+ } else if (fsRelPath.startsWith(path + "/")) {
+ res = relPath.substring(path.length());
+ }
+ if (res != null) {
+ for (String resourcesDir : dirList) {
+ File f = new File(resourcesDir, res);
+ if (f.exists() && f.canRead() && f.isDirectory()) {
+ List<NamingEntry> virtEntries = super.list(f);
+ for (NamingEntry entry : virtEntries) {
+ // filter duplicate
+ if (!entryNames.contains(entry.name)) {
+ entryNames.add(entry.name);
+ entries.add(entry);
+ }
+ }
+
+ }
+ }
+ }
+ }
+ }
}
return entries;
@@ -161,65 +256,47 @@ public class VirtualDirContext extends F
@Override
protected Object doLookup(String name) {
- // handle "virtual" tlds
- if (name.startsWith("/WEB-INF/") && name.endsWith(".tld")) {
- String tldName = name.substring(name.lastIndexOf("/") + 1);
- if (virtualMappings.containsKey(tldName)) {
- return new FileResource(virtualMappings.get(tldName));
- }
- } else if (name.startsWith("/META-INF/tags") && name.endsWith(".tag")
- || name.endsWith(".tagx")) {
-
- // already loaded tag file: we are sure that getAttributes() has
- // already been called if we are here
- File tagFile = tagfileMappings.get(name);
- if (tagFile != null) {
- return new FileResource(tagFile);
- }
+ Object retSuper = super.doLookup(name);
+ if (retSuper != null || mappedResourcePaths == null) {
+ return retSuper;
}
- return super.doLookup(name);
- }
-
- /**
- * Scan a given dir for tld files. Any found tld will be added to the
- * virtualMappings.
- * @param dir Dir to scan for tlds
- */
- private void scanForTlds(File dir) {
-
- File[] files = dir.listFiles();
- for (int j = 0; j < files.length; j++) {
- File file = files[j];
-
- if (file.isDirectory()) {
- scanForTlds(file);
- } else if (file.getName().endsWith(".tld")) {
- // just generate a random name using the current timestamp, name
- // doesn't matter since it needs to be referenced by URI
- String virtualTldName = "~" + System.currentTimeMillis() + "~"
- + file.getName();
- virtualMappings.put(virtualTldName, file);
+ // Perform lookup using the extra resource paths
+ for (Map.Entry<String, List<String>> mapping : mappedResourcePaths.entrySet()) {
+ String path = mapping.getKey();
+ List<String> dirList = mapping.getValue();
+ if (name.equals(path)) {
+ for (String resourcesDir : dirList) {
+ File f = new File(resourcesDir);
+ if (f.exists() && f.canRead()) {
+ if (f.isFile()) {
+ return new FileResource(f);
+ }
+ else {
+ // never goes here, if f is a directory the super
+ // implementation already returned a value
+ }
+ }
+ }
+ }
+ path += "/";
+ if (name.startsWith(path)) {
+ String res = name.substring(path.length());
+ for (String resourcesDir : dirList) {
+ File f = new File(resourcesDir + "/" + res);
+ if (f.exists() && f.canRead()) {
+ if (f.isFile()) {
+ return new FileResource(f);
+ }
+ else {
+ // never goes here, if f is a directory the super
+ // implementation already returned a value
+ }
+ }
+ }
}
}
-
- }
-
- /**
- * Returns a list of virtual naming entries.
- * @return list of naming entries, containing tlds in virtualMappings
- */
- private List<NamingEntry> getVirtualNamingEntries() {
- List<NamingEntry> virtual = new ArrayList<NamingEntry>();
-
- for (String name : virtualMappings.keySet()) {
-
- File file = virtualMappings.get(name);
- NamingEntry entry = new NamingEntry(name, new FileResource(file),
- NamingEntry.ENTRY);
- virtual.add(entry);
- }
- return virtual;
+ return retSuper;
}
}
Added: tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java (added)
+++ tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java Fri Dec 2 20:49:50 2011
@@ -0,0 +1,30 @@
+package org.apache.catalina.loader;
+
+import java.io.IOException;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+public class EchoTag extends TagSupport {
+ private static final long serialVersionUID = 1L;
+
+ private String echo = null;
+
+ public void setEcho(String echo) {
+ this.echo = echo;
+ }
+
+ public String getEcho() {
+ return echo;
+ }
+
+ @Override
+ public int doStartTag() throws JspException {
+ try {
+ pageContext.getOut().print("<p>" + echo + "</p>");
+ } catch (IOException e) {
+ throw new JspException(e);
+ }
+ return super.doStartTag();
+ }
+}
Propchange: tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/test/org/apache/catalina/loader/EchoTag.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java (added)
+++ tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java Fri Dec 2 20:49:50 2011
@@ -0,0 +1,24 @@
+package org.apache.catalina.loader;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+@WebServlet(value = "/annotatedServlet")
+public class MyAnnotatedServlet extends HttpServlet {
+
+ static final String MESSAGE = "This is generated by an annotated servlet";
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+ throws ServletException, IOException {
+ resp.setContentType("test/plain");
+ resp.getWriter().println(MESSAGE);
+ }
+
+}
Propchange: tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/test/org/apache/catalina/loader/MyAnnotatedServlet.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java (added)
+++ tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java Fri Dec 2 20:49:50 2011
@@ -0,0 +1,303 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.catalina.loader;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashSet;
+
+import junit.framework.Assert;
+
+import org.apache.catalina.core.JreMemoryLeakPreventionListener;
+import org.apache.catalina.core.StandardContext;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.catalina.startup.TomcatBaseTest;
+import org.apache.naming.resources.VirtualDirContext;
+import org.apache.tomcat.util.buf.ByteChunk;
+import org.apache.tomcat.util.http.fileupload.FileUtils;
+import org.apache.tomcat.util.http.fileupload.IOUtils;
+import org.apache.tomcat.util.scan.StandardJarScanner;
+import org.junit.Test;
+
+public class TestVirtualContext extends TomcatBaseTest {
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ Tomcat tomcat = getTomcatInstance();
+
+ // BZ 49218: The test fails if JreMemoryLeakPreventionListener is not
+ // present. The listener affects the JVM, and thus not only the current,
+ // but also the subsequent tests that are run in the same JVM. So it is
+ // fair to add it in every test.
+ tomcat.getServer().addLifecycleListener(
+ new JreMemoryLeakPreventionListener());
+ }
+
+ @Test
+ public void testVirtualClassLoader() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+
+ File appDir = new File("test/webapp-3.0-virtual-webapp/src/main/webapp");
+ // app dir is relative to server home
+ StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
+ appDir.getAbsolutePath());
+
+ VirtualWebappLoader loader = new VirtualWebappLoader(ctx.getParentClassLoader());
+ loader.setVirtualClasspath(//
+ "test/webapp-3.0-virtual-webapp/target/classes;" + //
+ "test/webapp-3.0-virtual-library/target/classes;" + //
+ "test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes;" + //
+ "test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes");
+ ctx.setLoader(loader);
+
+ String extraMappings = "/=test/webapp-3.0-virtual-webapp/src/main/webapp2" + //
+ ",/other=test/webapp-3.0-virtual-webapp/src/main/misc" + //
+ ",/WEB-INF/classes=test/webapp-3.0-virtual-webapp/target/classes";
+ VirtualDirContext resources = new VirtualDirContext();
+ resources.setExtraResourcePaths(extraMappings);
+ ctx.setResources(resources);
+
+ StandardJarScanner jarScanner = new StandardJarScanner();
+ jarScanner.setScanAllDirectories(true);
+ ctx.setJarScanner(jarScanner);
+
+ tomcat.start();
+
+ assertPageContains("/test/classpathGetResourceAsStream.jsp?path=nonexistent",
+ "resourceAInWebInfClasses=true", 404);
+
+ assertPageContains(
+ "/test/classpathGetResourceAsStream.jsp?path=rsrc/resourceA.properties",
+ "resourceAInWebInfClasses=true");
+ assertPageContains(
+ "/test/classpathGetResourceUrlThenGetStream.jsp?path=rsrc/resourceA.properties",
+ "resourceAInWebInfClasses=true");
+
+ assertPageContains(
+ "/test/classpathGetResourceAsStream.jsp?path=rsrc/resourceB.properties",
+ "resourceBInTargetClasses=true");
+ assertPageContains(
+ "/test/classpathGetResourceUrlThenGetStream.jsp?path=rsrc/resourceB.properties",
+ "resourceBInTargetClasses=true");
+
+ assertPageContains(
+ "/test/classpathGetResourceAsStream.jsp?path=rsrc/resourceC.properties",
+ "resourceCInDependentLibraryTargetClasses=true");
+ assertPageContains(
+ "/test/classpathGetResourceUrlThenGetStream.jsp?path=rsrc/resourceC.properties",
+ "resourceCInDependentLibraryTargetClasses=true");
+
+ assertPageContains(
+ "/test/classpathGetResourceAsStream.jsp?path=rsrc/resourceD.properties",
+ "resourceDInPackagedJarInWebInfLib=true");
+ assertPageContains(
+ "/test/classpathGetResourceUrlThenGetStream.jsp?path=rsrc/resourceD.properties",
+ "resourceDInPackagedJarInWebInfLib=true");
+
+ assertPageContains(
+ "/test/classpathGetResourceAsStream.jsp?path=rsrc/resourceG.properties",
+ "resourceGInWebInfClasses=true");
+ assertPageContains(
+ "/test/classpathGetResourceUrlThenGetStream.jsp?path=rsrc/resourceG.properties",
+ "resourceGInWebInfClasses=true");
+
+ // test listing all possible paths for a classpath resource
+ String allUrls =
+ getUrl(
+ "http://localhost:" + getPort() +
+ "/test/classpathGetResources.jsp?path=rsrc/").toString();
+ assertTrue(
+ allUrls,
+ allUrls.indexOf("/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc") > 0);
+ assertTrue(
+ allUrls,
+ allUrls.indexOf("/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc") > 0);
+ assertTrue(
+ allUrls,
+ allUrls.indexOf("/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar!/rsrc") > 0);
+ assertTrue(
+ allUrls,
+ allUrls.indexOf("/test/webapp-3.0-virtual-webapp/target/classes/rsrc") > 0);
+ assertTrue(
+ allUrls,
+ allUrls.indexOf("/test/webapp-3.0-virtual-library/target/classes/rsrc") > 0);
+
+ // check that there's no duplicate in the URLs
+ String[] allUrlsArray = allUrls.split("\\s+");
+ Assert.assertEquals(new HashSet<String>(Arrays.asList(allUrlsArray)).size(),
+ allUrlsArray.length);
+
+ String allRsrsc2ClasspathUrls =
+ getUrl(
+ "http://localhost:" + getPort() +
+ "/test/classpathGetResources.jsp?path=rsrc2/").toString();
+ assertTrue(
+ allRsrsc2ClasspathUrls,
+ allRsrsc2ClasspathUrls.indexOf("/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2") > 0);
+
+ // tests context.getRealPath
+
+ // the following fails because getRealPath always return a non-null path
+ // even if there's no such resource
+ // assertPageContains("/test/contextGetRealPath.jsp?path=nonexistent",
+ // "resourceAInWebInfClasses=true", 404);
+ assertPageContains(
+ "/test/contextGetRealPath.jsp?path=/rsrc/resourceF.properties",
+ "/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties");
+
+ // tests context.getResource then the content
+
+ assertPageContains("/test/contextGetResource.jsp?path=nonexistent",
+ "resourceAInWebInfClasses=true", 404);
+ assertPageContains(
+ "/test/contextGetResource.jsp?path=/WEB-INF/classes/rsrc/resourceA.properties",
+ "resourceAInWebInfClasses=true");
+ assertPageContains(
+ "/test/contextGetResource.jsp?path=/WEB-INF/classes/rsrc/resourceG.properties",
+ "resourceGInWebInfClasses=true");
+ assertPageContains(
+ "/test/contextGetResource.jsp?path=/rsrc/resourceE.properties",
+ "resourceEInDependentLibraryTargetClasses=true");
+ assertPageContains(
+ "/test/contextGetResource.jsp?path=/other/resourceI.properties",
+ "resourceIInWebapp=true");
+ assertPageContains(
+ "/test/contextGetResource.jsp?path=/rsrc2/resourceJ.properties",
+ "resourceJInWebapp=true");
+
+ String allRsrcPaths =
+ getUrl(
+ "http://localhost:" + getPort() +
+ "/test/contextGetResourcePaths.jsp?path=/rsrc/").toString();
+ assertTrue(
+ allRsrcPaths,
+ allRsrcPaths.indexOf("/rsrc/resourceF.properties") > 0);
+ assertTrue(
+ allRsrcPaths,
+ allRsrcPaths.indexOf("/rsrc/resourceE.properties") > 0);
+ assertTrue(
+ allRsrcPaths,
+ allRsrcPaths.indexOf("/rsrc/resourceH.properties") > 0);
+
+ // check that there's no duplicate in the URLs
+ String[] allRsrcPathsArray = allRsrcPaths.split("\\s+");
+ Assert.assertEquals(new HashSet<String>(Arrays.asList(allRsrcPathsArray)).size(),
+ allRsrcPathsArray.length);
+
+ String allRsrc2Paths =
+ getUrl(
+ "http://localhost:" + getPort() +
+ "/test/contextGetResourcePaths.jsp?path=/rsrc2/").toString();
+ assertTrue(
+ allRsrc2Paths,
+ allRsrc2Paths.indexOf("/rsrc2/resourceJ.properties") > 0);
+
+ assertPageContains(
+ "/test/testTlds.jsp",
+ "worldA");
+ assertPageContains(
+ "/test/testTlds.jsp",
+ "worldB");
+ assertPageContains(
+ "/test/testTlds.jsp",
+ "worldC");
+ assertPageContains(
+ "/test/testTlds.jsp",
+ "worldD");
+ }
+
+ @Test
+ public void testAdditionalWebInfClassesPaths() throws Exception {
+ Tomcat tomcat = getTomcatInstance();
+
+ File appDir = new File("test/webapp-3.0-virtual-webapp/src/main/webapp");
+ // app dir is relative to server home
+ StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
+ appDir.getAbsolutePath());
+ File tempFile = File.createTempFile("virtualWebInfClasses", null);
+
+ File additionWebInfClasses = new File(tempFile.getAbsolutePath() + ".dir");
+ Assert.assertTrue(additionWebInfClasses.mkdirs());
+ File targetPackageForAnnotatedClass =
+ new File(additionWebInfClasses,
+ MyAnnotatedServlet.class.getPackage().getName().replace('.', '/'));
+ Assert.assertTrue(targetPackageForAnnotatedClass.mkdirs());
+ InputStream annotatedServletClassInputStream =
+ this.getClass().getResourceAsStream(
+ MyAnnotatedServlet.class.getSimpleName() + ".class");
+ FileOutputStream annotatedServletClassOutputStream =
+ new FileOutputStream(new File(targetPackageForAnnotatedClass,
+ MyAnnotatedServlet.class.getSimpleName() + ".class"));
+ IOUtils.copy(annotatedServletClassInputStream, annotatedServletClassOutputStream);
+ annotatedServletClassInputStream.close();
+ annotatedServletClassOutputStream.close();
+
+ VirtualWebappLoader loader = new VirtualWebappLoader(ctx.getParentClassLoader());
+ loader.setVirtualClasspath("test/webapp-3.0-virtual-webapp/target/classes;" + //
+ "test/webapp-3.0-virtual-library/target/classes;" + //
+ additionWebInfClasses.getAbsolutePath());
+ ctx.setLoader(loader);
+
+ tomcat.start();
+ // first test that without the setting on StandardContext the annotated
+ // servlet is not detected
+ assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE, 404);
+
+ tomcat.stop();
+
+ // then test that if we configure StandardContext with the additional
+ // path, the servlet is detected
+ // ctx.setAdditionalVirtualWebInfClasses(additionWebInfClasses.getAbsolutePath());
+ VirtualDirContext resources = new VirtualDirContext();
+ resources.setExtraResourcePaths("/WEB-INF/classes=" + additionWebInfClasses);
+ ctx.setResources(resources);
+
+ tomcat.start();
+ assertPageContains("/test/annotatedServlet", MyAnnotatedServlet.MESSAGE);
+ tomcat.stop();
+ FileUtils.deleteDirectory(additionWebInfClasses);
+ tempFile.delete();
+ }
+
+ private void assertPageContains(String pageUrl, String expectedBody)
+ throws IOException {
+
+ assertPageContains(pageUrl, expectedBody, 200);
+ }
+
+ private void assertPageContains(String pageUrl, String expectedBody,
+ int expectedStatus) throws IOException {
+ ByteChunk res = new ByteChunk();
+ int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, null);
+
+ assertEquals(expectedStatus, sc);
+
+ if (expectedStatus == 200) {
+ String result = res.toString();
+ assertTrue(result, result.indexOf(expectedBody) >= 0);
+ }
+ }
+}
Propchange: tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tomcat/trunk/test/org/apache/catalina/loader/TestVirtualContext.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld Fri Dec 2 20:49:50 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+ <tlib-version>1.0</tlib-version>
+ <short-name>B</short-name>
+ <uri>http://tomcat.apache.org/B</uri>
+
+ <tag>
+ <name>Echo</name>
+ <tag-class>org.apache.jasper.compiler.TestValidator$Echo</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>echo</name>
+ <required>yes</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/META-INF/B.tld
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceDInPackagedJarInWebInfLib=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/lib/rsrc/resourceD.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceIInWebapp=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/misc/resourceI.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml Fri Dec 2 20:49:50 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
+ license agreements. See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership. The ASF licenses this file to You under
+ the Apache License, Version 2.0 (the "License"); you may not use this file except
+ in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
+ Unless required by applicable law or agreed to in writing, software distributed under
+ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
+ OF ANY KIND, either express or implied. See the License for the specific language
+ governing permissions and limitations under the License. -->
+<Context>
+ <!-- <Resources className="org.eclipse.jst.server.tomcat.loader.WtpDirContext" -->
+ <!-- extraResourcePaths="/WEB-INF/classes|/Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELEASE/clinic/target/classes" -->
+ <!-- virtualClasspath="/Users/slaurent/dev/workspaces/workspace-sts-2.6.0.RELEASE/clinic/target/classes;/Users/slaurent/.m2/repository/log4j/log4j/1.2.16/log4j-1.2.16.jar;/Users/slaurent/.m2/repository/org/slf4j/slf4j-api/1.6.1/slf4j-api-1.6.1.jar;/Users/slaurent/.m2/repository/org/slf4j/jcl-over-slf4j/1.6.1/jcl-over-slf4j-1.6.1.jar;/Users/slaurent/.m2/repository/org/slf4j/slf4j-log4j12/1.6.1/slf4j-log4j12-1.6.1.jar;/Users/slaurent/.m2/repository/org/aspectj/aspectjrt/1.6.11.M2/aspectjrt-1.6.11.M2.jar;/Users/slaurent/.m2/repository/org/aspectj/aspectjweaver/1.6.11.M2/aspectjweaver-1.6.11.M2.jar;/Users/slaurent/.m2/repository/net/sf/flexjson/flexjson/2.1/flexjson-2.1.jar;/Users/slaurent/.m2/repository/org/springframework/spring-core/3.0.5.RELEASE/spring-core-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-asm/3.0.5.RELEASE/spring-asm-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-context/3.0.5.RELEASE/spring-context-3
.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-beans/3.0.5.RELEASE/spring-beans-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-expression/3.0.5.RELEASE/spring-expression-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-aop/3.0.5.RELEASE/spring-aop-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar;/Users/slaurent/.m2/repository/org/springframework/spring-aspects/3.0.5.RELEASE/spring-aspects-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-context-support/3.0.5.RELEASE/spring-context-support-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-tx/3.0.5.RELEASE/spring-tx-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/hsqldb/hsqldb/1.8.0.10/hsqldb-1.8.0.10.jar;/Users/slaurent/.m2/repository/org/hibernate/hibernate-core/3.6.1.Final/hibernate-core-3.6.1.Final.jar;/Users/slaurent/.m2/repository/ant
lr/antlr/2.7.6/antlr-2.7.6.jar;/Users/slaurent/.m2/repository/commons-collections/commons-collections/3.1/commons-collections-3.1.jar;/Users/slaurent/.m2/repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar;/Users/slaurent/.m2/repository/org/hibernate/hibernate-commons-annotations/3.2.0.Final/hibernate-commons-annotations-3.2.0.Final.jar;/Users/slaurent/.m2/repository/org/hibernate/hibernate-entitymanager/3.6.1.Final/hibernate-entitymanager-3.6.1.Final.jar;/Users/slaurent/.m2/repository/javassist/javassist/3.12.0.GA/javassist-3.12.0.GA.jar;/Users/slaurent/.m2/repository/org/hibernate/javax/persistence/hibernate-jpa-2.0-api/1.0.0.Final/hibernate-jpa-2.0-api-1.0.0.Final.jar;/Users/slaurent/.m2/repository/org/hibernate/hibernate-validator/4.1.0.Final/hibernate-validator-4.1.0.Final.jar;/Users/slaurent/.m2/repository/javax/validation/validation-api/1.0.0.GA/validation-api-1.0.0.GA.jar;/Users/slaurent/.m2/repository/cglib/cglib-nodep/2.2/cglib-nodep-2.2.jar;/Users/slaurent/.m2/repository
/javax/transaction/jta/1.1/jta-1.1.jar;/Users/slaurent/.m2/repository/org/springframework/spring-jdbc/3.0.5.RELEASE/spring-jdbc-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/spring-orm/3.0.5.RELEASE/spring-orm-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/commons-pool/commons-pool/1.5.4/commons-pool-1.5.4.jar;/Users/slaurent/.m2/repository/commons-dbcp/commons-dbcp/1.3/commons-dbcp-1.3.jar;/Users/slaurent/.m2/repository/org/apache/tiles/tiles-core/2.2.1/tiles-core-2.2.1.jar;/Users/slaurent/.m2/repository/org/apache/tiles/tiles-api/2.2.1/tiles-api-2.2.1.jar;/Users/slaurent/.m2/repository/org/apache/tiles/tiles-jsp/2.2.1/tiles-jsp-2.2.1.jar;/Users/slaurent/.m2/repository/org/apache/tiles/tiles-servlet/2.2.1/tiles-servlet-2.2.1.jar;/Users/slaurent/.m2/repository/org/apache/tiles/tiles-template/2.2.1/tiles-template-2.2.1.jar;/Users/slaurent/.m2/repository/org/springframework/spring-web/3.0.5.RELEASE/spring-web-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repos
itory/org/springframework/spring-webmvc/3.0.5.RELEASE/spring-webmvc-3.0.5.RELEASE.jar;/Users/slaurent/.m2/repository/org/springframework/webflow/spring-js-resources/2.2.1.RELEASE/spring-js-resources-2.2.1.RELEASE.jar;/Users/slaurent/.m2/repository/commons-digester/commons-digester/2.0/commons-digester-2.0.jar;/Users/slaurent/.m2/repository/commons-beanutils/commons-beanutils/1.8.0/commons-beanutils-1.8.0.jar;/Users/slaurent/.m2/repository/commons-fileupload/commons-fileupload/1.2.1/commons-fileupload-1.2.1.jar;/Users/slaurent/.m2/repository/javax/servlet/jstl/1.2/jstl-1.2.jar;/Users/slaurent/.m2/repository/joda-time/joda-time/1.6/joda-time-1.6.jar"
+ /> -->
+ <Loader className="org.apache.catalina.loader.VirtualWebappLoader"
+ virtualClasspath="test/webapp-3.0-virtual-webapp/target/classes;test/webapp-3.0-virtual-library/target/classes" />
+</Context>
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/META-INF/context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld Fri Dec 2 20:49:50 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+ <tlib-version>1.0</tlib-version>
+ <short-name>A</short-name>
+ <uri>http://tomcat.apache.org/A</uri>
+
+ <tag>
+ <name>Echo</name>
+ <tag-class>org.apache.jasper.compiler.TestValidator$Echo</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>echo</name>
+ <required>yes</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/A.tld
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceAInWebInfClasses=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar?rev=1209686&view=auto
==============================================================================
Files tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar (added) and tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar Fri Dec 2 20:49:50 2011 differ
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml Fri Dec 2 20:49:50 2011
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
+ version="3.0"
+ metadata-complete="false">
+</web-app>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,32 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+
+<%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+if(path.startsWith("/")) path = path.substring(1);
+java.io.InputStream is = this.getClass().getClassLoader().getResourceAsStream(path);
+if(is==null) {
+ response.setStatus(404);
+ response.getWriter().println(path+ " not found in classpath");
+ return;
+}
+int b;
+while((b=is.read()) != -1){
+ out.write(b);
+}
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,33 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+
+<%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+if(path.startsWith("/")) path = path.substring(1);
+java.net.URL url = this.getClass().getClassLoader().getResource(path);
+if(url==null) {
+ response.setStatus(404);
+ response.getWriter().println(path+ " not found in classpath");
+ return;
+}
+java.io.InputStream is = url.openStream();
+int b;
+while((b=is.read()) != -1){
+ out.write(b);
+}
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,25 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%><%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+if(path.startsWith("/")) path = path.substring(1);
+java.util.Enumeration<java.net.URL> e = this.getClass().getClassLoader().getResources(path);
+while(e.hasMoreElements()){
+ java.net.URL url = e.nextElement();
+ out.println(url);
+}
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/classpathGetResources.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,28 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+
+<%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+String realPath = application.getRealPath(path);
+if(realPath==null) {
+ response.setStatus(404);
+ response.getWriter().println(path+ " cannot find real path");
+ return;
+}
+response.getWriter().println(realPath);
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetRealPath.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,36 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+
+<%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+java.net.URL url = application.getResource(path);
+if(url==null) {
+ response.setStatus(404);
+ response.getWriter().println(path+ " not found as context resource");
+ return;
+}
+java.io.InputStream is = url.openStream();
+try {
+ int b;
+ while((b=is.read()) != -1){
+ out.write(b);
+ }
+} finally {
+ is.close();
+}
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResource.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,27 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+
+<%
+response.setContentType("text/plain");
+String path = request.getParameter("path");
+java.util.Set<String> paths = application.getResourcePaths(path);
+if(paths!=null){
+ for(String p : paths) {
+ out.println(p);
+ }
+}
+%>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceFInWebapp=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp Fri Dec 2 20:49:50 2011
@@ -0,0 +1,26 @@
+<%--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--%>
+<html><body>
+<%@ taglib prefix="A" uri="http://tomcat.apache.org/A" %>
+<%@ taglib prefix="B" uri="http://tomcat.apache.org/B" %>
+<%@ taglib prefix="C" uri="http://tomcat.apache.org/C" %>
+<%@ taglib prefix="D" uri="http://tomcat.apache.org/D" %>
+<A:Echo echo="worldA"/>
+<B:Echo echo="worldB"/>
+<C:Echo echo="worldC"/>
+<D:Echo echo="worldD"/>
+</body></html>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp/testTlds.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld Fri Dec 2 20:49:50 2011
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+--><taglib xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+ http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
+ version="2.1">
+ <tlib-version>1.0</tlib-version>
+ <short-name>D</short-name>
+ <uri>http://tomcat.apache.org/D</uri>
+
+ <tag>
+ <name>Echo</name>
+ <tag-class>org.apache.jasper.compiler.TestValidator$Echo</tag-class>
+ <body-content>empty</body-content>
+ <attribute>
+ <name>echo</name>
+ <required>yes</required>
+ <rtexprvalue>true</rtexprvalue>
+ </attribute>
+ </tag>
+
+</taglib>
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/D.tld
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceGInWebInfClasses=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceKInWebInfClasses=true
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,17 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+This file should not be served, it is masked by
+/test/webapp-3.0-virtual-webapp/src/main/webapp/rsrc/resourceF.properties
\ No newline at end of file
Propchange: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties
------------------------------------------------------------------------------
svn:eol-style = native
Added: tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties
URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties?rev=1209686&view=auto
==============================================================================
--- tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties (added)
+++ tomcat/trunk/test/webapp-3.0-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties Fri Dec 2 20:49:50 2011
@@ -0,0 +1,16 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+resourceHInWebapp=true
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1209686 [1/2] - in /tomcat/trunk: java/org/apache/catalina/core/
java/org/apache/catalina/loader/ java/org/apache/catalina/startup/ java/org/apache/naming/resources/
test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Posted by Mark Thomas <ma...@apache.org>.
On 02/12/2011 21:20, Mark Thomas wrote:
> On 02/12/2011 21:08, Mark Thomas wrote:
>> On 02/12/2011 20:49, slaurent@apache.org wrote:
>>> Author: slaurent
>>> Date: Fri Dec 2 20:49:50 2011
>>> New Revision: 1209686
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1209686&view=rev
>>> Log:
>>> bug 51741: Eclipse WTP "Serve modules without publishing" broken with
>>> tc7, needs patch in tomcat
>>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
>>
>> You need to run checkstyle on this. There are a number of issues including:
>> - files without license headers
>> - files with license headers that do not use the expected layout
>> - an import from o.a.catlina used within o.a.naming wich is not permitted
>
> Just seen that this is unused which makes this an easy fix.
They were all easy and fixing the failures was just as easy as skipping
the checks. Patch applied to trunk.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1209686 [1/2] - in /tomcat/trunk: java/org/apache/catalina/core/
java/org/apache/catalina/loader/ java/org/apache/catalina/startup/ java/org/apache/naming/resources/
test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Posted by Mark Thomas <ma...@apache.org>.
On 02/12/2011 21:08, Mark Thomas wrote:
> On 02/12/2011 20:49, slaurent@apache.org wrote:
>> Author: slaurent
>> Date: Fri Dec 2 20:49:50 2011
>> New Revision: 1209686
>>
>> URL: http://svn.apache.org/viewvc?rev=1209686&view=rev
>> Log:
>> bug 51741: Eclipse WTP "Serve modules without publishing" broken with
>> tc7, needs patch in tomcat
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
>
> You need to run checkstyle on this. There are a number of issues including:
> - files without license headers
> - files with license headers that do not use the expected layout
> - an import from o.a.catlina used within o.a.naming wich is not permitted
Just seen that this is unused which makes this an easy fix.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1209686 [1/2] - in /tomcat/trunk: java/org/apache/catalina/core/
java/org/apache/catalina/loader/ java/org/apache/catalina/startup/ java/org/apache/naming/resources/
test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Posted by Mark Thomas <ma...@apache.org>.
On 02/12/2011 21:25, Sylvain Laurent wrote:
> good catch. Actually I did perform a ant test to check that all tests
> pass, but the "validate" target is not run by default. Why isn't it
> enabled by default ?
Because Checkstyle uses a license (LGPL?) that is not AL2 compatible so
we require explicit enabling of those checks in build.properties. There
should be a comment to that effect in build.properties.default.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1209686 [1/2] - in /tomcat/trunk: java/org/apache/catalina/core/ java/org/apache/catalina/loader/ java/org/apache/catalina/startup/ java/org/apache/naming/resources/ test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Posted by Sylvain Laurent <sl...@apache.org>.
good catch. Actually I did perform a ant test to check that all tests pass, but the "validate" target is not run by default. Why isn't it enabled by default ?
Sylvain
On 2 déc. 2011, at 22:08, Mark Thomas wrote:
> On 02/12/2011 20:49, slaurent@apache.org wrote:
>> Author: slaurent
>> Date: Fri Dec 2 20:49:50 2011
>> New Revision: 1209686
>>
>> URL: http://svn.apache.org/viewvc?rev=1209686&view=rev
>> Log:
>> bug 51741: Eclipse WTP "Serve modules without publishing" broken with
>> tc7, needs patch in tomcat
>> https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
>
> You need to run checkstyle on this. There are a number of issues including:
> - files without license headers
> - files with license headers that do not use the expected layout
> - an import from o.a.catlina used within o.a.naming wich is not permitted
>
> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1209686 [1/2] - in /tomcat/trunk: java/org/apache/catalina/core/
java/org/apache/catalina/loader/ java/org/apache/catalina/startup/ java/org/apache/naming/resources/
test/org/apache/catalina/loader/ test/webapp-3.0-virtual-webapp/ test/web...
Posted by Mark Thomas <ma...@apache.org>.
On 02/12/2011 20:49, slaurent@apache.org wrote:
> Author: slaurent
> Date: Fri Dec 2 20:49:50 2011
> New Revision: 1209686
>
> URL: http://svn.apache.org/viewvc?rev=1209686&view=rev
> Log:
> bug 51741: Eclipse WTP "Serve modules without publishing" broken with
> tc7, needs patch in tomcat
> https://issues.apache.org/bugzilla/show_bug.cgi?id=51741
You need to run checkstyle on this. There are a number of issues including:
- files without license headers
- files with license headers that do not use the expected layout
- an import from o.a.catlina used within o.a.naming wich is not permitted
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org