Author: remm Date: Fri Oct 4 14:11:05 2013 New Revision: 1529165 URL: http://svn.apache.org/r1529165 Log: - Must filter out that thread local listener on the context ... - Save the context configuration in configBase if no configFile exists (it's not possible to determine if there are relevant changes or not)
Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java tomcat/trunk/java/org/apache/catalina/storeconfig/server-registry.xml Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java?rev=1529165&r1=1529164&r2=1529165&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/StandardContextSF.java Fri Oct 4 14:11:05 2013 @@ -37,7 +37,9 @@ import org.apache.catalina.Realm; import org.apache.catalina.Valve; import org.apache.catalina.WebResourceRoot; import org.apache.catalina.core.StandardContext; +import org.apache.catalina.core.ThreadLocalLeakPreventionListener; import org.apache.catalina.deploy.NamingResourcesImpl; +import org.apache.catalina.util.ContextName; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.util.descriptor.web.ApplicationParameter; @@ -81,6 +83,19 @@ public class StandardContextSF extends S return; } } else if (desc.isExternalOnly()) { + // Set a configFile so that the configuration is actually saved + Context context = ((StandardContext) aContext); + Host host = (Host) context.getParent(); + File configBase = host.getConfigBaseFile(); + ContextName cn = new ContextName(context.getName()); + String baseName = cn.getBaseName(); + File xml = new File(configBase, baseName + ".xml"); + context.setConfigFile(xml.toURI().toURL()); + if (desc.isBackup()) + storeWithBackup((StandardContext) aContext); + else + storeContextSeparate(aWriter, indent, + (StandardContext) aContext); return; } } @@ -243,7 +258,13 @@ public class StandardContextSF extends S StandardContext context = (StandardContext) aContext; // Store nested <Listener> elements LifecycleListener listeners[] = context.findLifecycleListeners(); - storeElementArray(aWriter, indent, listeners); + ArrayList<LifecycleListener> listenersArray = new ArrayList<>(); + for (LifecycleListener listener : listeners) { + if (!(listener instanceof ThreadLocalLeakPreventionListener)) { + listenersArray.add(listener); + } + } + storeElementArray(aWriter, indent, listenersArray.toArray()); // Store nested <Valve> elements Valve valves[] = context.getPipeline().getValves(); @@ -352,7 +373,7 @@ public class StandardContextSF extends S "conf/web.xml").getCanonicalPath(); String confHostDefault = new File(configBase, "context.xml.default") .getCanonicalPath(); - String configFile = new File(context.getConfigFile().toURI()).getCanonicalPath(); + String configFile = (context.getConfigFile() != null ? new File(context.getConfigFile().toURI()).getCanonicalPath() : null); String webxml = "WEB-INF/web.xml" ; List<String> resource = new ArrayList<>(); Modified: tomcat/trunk/java/org/apache/catalina/storeconfig/server-registry.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/storeconfig/server-registry.xml?rev=1529165&r1=1529164&r2=1529165&view=diff ============================================================================== --- tomcat/trunk/java/org/apache/catalina/storeconfig/server-registry.xml (original) +++ tomcat/trunk/java/org/apache/catalina/storeconfig/server-registry.xml Fri Oct 4 14:11:05 2013 @@ -57,7 +57,7 @@ default="true" externalAllowed="true" externalOnly="true" - storeSeparate="true" + storeSeparate="true" backup="true" children="true" tagClass="org.apache.catalina.core.StandardContext" @@ -259,8 +259,7 @@ <TransientAttribute>cacheTTL</TransientAttribute> <TransientAttribute>cacheMaxSize</TransientAttribute> <TransientAttribute>cacheMaxObjectSize</TransientAttribute> - <TransientAttribute>docBase</TransientAttribute> - <TransientAttribute>cached</TransientAttribute> + <TransientAttribute>cached</TransientAttribute> <TransientAttribute>caseSensitive</TransientAttribute> </Description> <Description --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org