remm 2004/09/22 23:58:52 Modified: catalina/src/share/org/apache/catalina/core StandardContext.java catalina/src/share/org/apache/catalina/startup ContextConfig.java ContextRuleSet.java Added: catalina/src/share/org/apache/catalina/startup SetContextPropertiesRule.java Log: - Fix bad test using isFile. Somehow, this doesn't seem to follow what is in the javadocs, and returns false all the time, so support for packed WARs was broken. !isDirectory is now used instead. - When parsing a context file, ignore the "path" attribute. The only place where it is acceptable is in server.xml. Revision Changes Path 1.147 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java Index: StandardContext.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardContext.java,v retrieving revision 1.146 retrieving revision 1.147 diff -u -r1.146 -r1.147 --- StandardContext.java 16 Sep 2004 15:30:32 -0000 1.146 +++ StandardContext.java 23 Sep 2004 06:58:51 -0000 1.147 @@ -3921,7 +3921,7 @@ if (log.isDebugEnabled()) log.debug("Configuring default Resources"); try { - if ((docBase != null) && (docBase.endsWith(".war")) && ((new File(docBase)).isFile())) + if ((docBase != null) && (docBase.endsWith(".war")) && (!(new File(docBase)).isDirectory())) setResources(new WARDirContext()); else setResources(new FileDirContext()); 1.57 +2 -2 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java Index: ContextConfig.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextConfig.java,v retrieving revision 1.56 retrieving revision 1.57 diff -u -r1.56 -r1.57 --- ContextConfig.java 17 Sep 2004 01:51:56 -0000 1.56 +++ ContextConfig.java 23 Sep 2004 06:58:52 -0000 1.57 @@ -789,7 +789,7 @@ docBase = file.getCanonicalPath(); } - if (docBase.toLowerCase().endsWith(".war") && file.isFile() && unpackWARs) { + if (docBase.toLowerCase().endsWith(".war") && !file.isDirectory() && unpackWARs) { URL war = new URL("jar:" + (new File(docBase)).toURL() + "!/"); String contextPath = context.getPath(); if (contextPath.equals("")) { 1.15 +8 -7 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextRuleSet.java Index: ContextRuleSet.java =================================================================== RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/ContextRuleSet.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- ContextRuleSet.java 21 Sep 2004 07:30:32 -0000 1.14 +++ ContextRuleSet.java 23 Sep 2004 06:58:52 -0000 1.15 @@ -117,13 +117,14 @@ public void addRuleInstances(Digester digester) { if (create) { - digester.addObjectCreate(prefix + "Context", - "org.apache.catalina.core.StandardContext", - "className"); + digester.addObjectCreate(prefix + "Context", + "org.apache.catalina.core.StandardContext", "className"); + digester.addSetProperties(prefix + "Context"); + } else { + digester.addRule(prefix + "Context", new SetContextPropertiesRule()); } - digester.addSetProperties(prefix + "Context"); - digester.addRule(prefix + "Context", - new CopyParentClassLoaderRule()); + digester.addRule(prefix + "Context", + new CopyParentClassLoaderRule()); if (create) { digester.addRule(prefix + "Context", new LifecycleListenerRule 1.1 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/startup/SetContextPropertiesRule.java Index: SetContextPropertiesRule.java =================================================================== /* * Copyright 1999-2001,2004 The Apache Software Foundation. * * Licensed 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.startup; import org.xml.sax.Attributes; import org.apache.tomcat.util.IntrospectionUtils; import org.apache.tomcat.util.digester.Rule; /** * Rule that uses the introspection utils to set properties of a context * (everything except "path"). * * @author Remy Maucherat */ public class SetContextPropertiesRule extends Rule { // ----------------------------------------------------------- Constructors // ----------------------------------------------------- Instance Variables // --------------------------------------------------------- Public Methods /** * Handle the beginning of an XML element. * * @param attributes The attributes of this element * * @exception Exception if a processing error occurs */ public void begin(String namespace, String nameX, Attributes attributes) throws Exception { for (int i = 0; i < attributes.getLength(); i++) { String name = attributes.getLocalName(i); if ("".equals(name)) { name = attributes.getQName(i); } if ("path".equals(name)) { continue; } String value = attributes.getValue(i); IntrospectionUtils.setProperty(digester.peek(), name, value); } } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]