You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ds...@apache.org on 2026/03/18 14:37:19 UTC
(tomcat) branch 9.0.x updated (5ef11e6fe5 -> 285098c2d0)
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a change to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
from 5ef11e6fe5 Fix indent
new 90b3026a66 Add round-trip verification to TestStoreConfig to ensure persisted server.xml produces startable configuration
new ffade09fb7 Improve docs for StoreConfig Lifecycle Listener
new 285098c2d0 Add missing /persist reference to HostManagerServlet javadoc
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../catalina/manager/host/HostManagerServlet.java | 3 +++
.../catalina/storeconfig/TestStoreConfig.java | 18 ++++++++++++-
webapps/docs/config/listeners.xml | 31 ++++++++++++++++------
3 files changed, 43 insertions(+), 9 deletions(-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 03/03: Add missing /persist reference to HostManagerServlet javadoc
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 285098c2d0e93cf3ba86cdedcfd1a56626fcc517
Author: Dimitris Soumis <ji...@gmail.com>
AuthorDate: Wed Mar 18 15:38:42 2026 +0200
Add missing /persist reference to HostManagerServlet javadoc
---
java/org/apache/catalina/manager/host/HostManagerServlet.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/java/org/apache/catalina/manager/host/HostManagerServlet.java b/java/org/apache/catalina/manager/host/HostManagerServlet.java
index 97526fe8ba..2501827034 100644
--- a/java/org/apache/catalina/manager/host/HostManagerServlet.java
+++ b/java/org/apache/catalina/manager/host/HostManagerServlet.java
@@ -65,6 +65,9 @@ import org.apache.tomcat.util.res.StringManager;
* <code>host-name#host-aliases</code>.</li>
* <li><b>/start?name={host-name}</b> - Start the virtual host.</li>
* <li><b>/stop?name={host-name}</b> - Stop the virtual host.</li>
+ * <li><b>/persist</b> - Persist the current server configuration to {@code server.xml}. Requires the
+ * {@link org.apache.catalina.storeconfig.StoreConfigLifecycleListener StoreConfigLifecycleListener} to
+ * be configured.</li>
* </ul>
* <p>
* <b>NOTE</b> - Attempting to stop or remove the host containing this servlet itself will not succeed. Therefore, this
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 01/03: Add round-trip verification to TestStoreConfig to ensure persisted server.xml produces startable configuration
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit 90b3026a66b76467bf9c3b9153075f40b020480e
Author: Dimitris Soumis <ji...@gmail.com>
AuthorDate: Wed Mar 18 14:45:41 2026 +0200
Add round-trip verification to TestStoreConfig to ensure persisted server.xml produces startable configuration
---
.../apache/catalina/storeconfig/TestStoreConfig.java | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/test/org/apache/catalina/storeconfig/TestStoreConfig.java b/test/org/apache/catalina/storeconfig/TestStoreConfig.java
index c1f6516eb5..5ece5707c0 100644
--- a/test/org/apache/catalina/storeconfig/TestStoreConfig.java
+++ b/test/org/apache/catalina/storeconfig/TestStoreConfig.java
@@ -26,7 +26,9 @@ import javax.xml.parsers.SAXParserFactory;
import org.junit.Assert;
import org.junit.Test;
+import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Catalina;
+import org.apache.catalina.startup.CatalinaBaseConfigurationSource;
import org.apache.catalina.startup.Tomcat;
import org.apache.catalina.startup.TomcatBaseTest;
import org.apache.catalina.util.IOTools;
@@ -129,7 +131,7 @@ public class TestStoreConfig extends TomcatBaseTest {
File serverXml = new File(tomcat.getServer().getCatalinaBase(), Catalina.SERVER_XML);
Assert.assertTrue(serverXml.canRead());
addDeleteOnTearDown(serverXml);
- String serverXmlDump = "";
+ String serverXmlDump;
try (FileReader reader = new FileReader(serverXml);
StringWriter writer = new StringWriter()) {
IOTools.flow(reader, writer);
@@ -143,6 +145,20 @@ public class TestStoreConfig extends TomcatBaseTest {
SAXParserFactory.newInstance().newSAXParser().getXMLReader().parse(new InputSource(new StringReader(serverXmlDump)));
tomcat.stop();
+
+ tomcat.init(new CatalinaBaseConfigurationSource(getTemporaryDirectory(), Catalina.SERVER_XML));
+ // If the persisted server.xml is malformed, start() will fail
+ tomcat.start();
+ Connector[] connectors = tomcat.getService().findConnectors();
+ boolean foundSsl = false;
+ for (Connector c : connectors) {
+ if (c.getSecure()) {
+ foundSsl = true;
+ break;
+ }
+ }
+ Assert.assertTrue("SSL connector not found after round-trip", foundSsl);
+ tomcat.stop();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
(tomcat) 02/03: Improve docs for StoreConfig Lifecycle Listener
Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dsoumis pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit ffade09fb7771245ec3d6dfbbe9623570da65ef0
Author: Dimitris Soumis <ji...@gmail.com>
AuthorDate: Wed Mar 18 15:37:10 2026 +0200
Improve docs for StoreConfig Lifecycle Listener
---
webapps/docs/config/listeners.xml | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/webapps/docs/config/listeners.xml b/webapps/docs/config/listeners.xml
index 418b92ce88..275e10139f 100644
--- a/webapps/docs/config/listeners.xml
+++ b/webapps/docs/config/listeners.xml
@@ -509,10 +509,23 @@
<subsection name="StoreConfig Lifecycle Listener - org.apache.catalina.storeconfig.StoreConfigLifecycleListener">
- <p>The <strong>StoreConfig Lifecycle Listener</strong> configures a
- StoreConfig MBean that may be used to save the current server configuration
- in server.xml or the current configuration for a web application in a
- context.xml file.</p>
+ <p>The <strong>StoreConfig Lifecycle Listener</strong> enables persisting
+ runtime configuration changes. When Tomcat's configuration is
+ modified at runtime, for example, adding or removing a virtual host
+ through the Host Manager, those changes only exist in memory and are lost
+ on restart. This listener provides the ability to write the current
+ in-memory configuration to <code>server.xml</code> (or an individual web
+ application's <code>context.xml</code>), so that runtime changes are
+ preserved across restarts.</p>
+
+ <p>When this listener is enabled, configuration persistence can be
+ triggered through the
+ <a href="../host-manager-howto.html#Persist_command">Host Manager</a> and
+ <a href="../manager-howto.html#Save_Configuration">Manager</a> applications.
+ The listener compares the current configuration against
+ default values and only writes attributes that differ from the defaults.
+ Before overwriting <code>server.xml</code>, a backup of the existing file
+ is created.</p>
<p>This listener must only be nested within <a href="server.html">Server</a>
elements.</p>
@@ -523,16 +536,18 @@
<attributes>
<attribute name="storeConfigClass" required="false">
- <p>The name of the <code>IStoreConfig</code> implementation to use. If
+ <p>The name of the <code>IStoreConfig</code> implementation to use.
+ This is an extension point for custom implementations. If
not specified the default of
<code>org.apache.catalina.storeconfig.StoreConfig</code> will be
used.</p>
</attribute>
<attribute name="storeRegistry" required="false">
- <p>The URL of the configuration file that configures how the
- <code>IStoreConfig</code> is to save the configuration. If not specified
- the built in resource
+ <p>The URL of the configuration file that defines how each server
+ component type (connectors, hosts, realms, valves, etc.) should be
+ serialized to XML. This is an extension point for custom serialization
+ rules. If not specified the built in resource
<code>/org/apache/catalina/storeconfig/server-registry.xml</code> will
be used.</p>
</attribute>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org