Author: funkman Date: Wed Jan 3 03:59:32 2007 New Revision: 492112 URL: http://svn.apache.org/viewvc?view=rev&rev=492112 Log: Update on http://issues.apache.org/bugzilla/show_bug.cgi?id=41260
Added warnings this should be for dev IDEs, not production. Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java?view=diff&rev=492112&r1=492111&r2=492112 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/VirtualWebappLoader.java Wed Jan 3 03:59:32 2007 @@ -34,6 +34,14 @@ * virtualClasspath="\dir\classes;\somedir\somejar.jar"/> * </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: $ */ Modified: tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java?view=diff&rev=492112&r1=492111&r2=492112 ============================================================================== --- tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java (original) +++ tomcat/tc6.0.x/trunk/java/org/apache/naming/resources/VirtualDirContext.java Wed Jan 3 03:59:32 2007 @@ -45,6 +45,13 @@ * virtualClasspath="\dir\classes;\somedir\somejar.jar"/> * </Resources> * </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: $ */ @@ -57,6 +64,12 @@ 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; @@ -79,6 +92,7 @@ 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, ";"); @@ -110,6 +124,23 @@ if (virtualMappings.containsKey(tldName)) { return new FileResourceAttributes(virtualMappings.get(tldName)); } + } else if (name.startsWith("/META-INF/tags") && name.endsWith(".tag") + || name.endsWith(".tagx")) { + + // already loaded tag file + if (tagfileMappings.containsKey(name)) { + return new FileResourceAttributes(tagfileMappings.get(name)); + } + + // 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); + } + } } return super.getAttributes(name); @@ -136,6 +167,15 @@ 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); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]