This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/main by this push:
new 45192db77a Rework status manager fix
45192db77a is described below
commit 45192db77a33283b53ff03d715c2a6ffa527ac75
Author: Mark Thomas <[email protected]>
AuthorDate: Tue Nov 18 08:13:38 2025 +0000
Rework status manager fix
---
.../apache/catalina/manager/StatusTransformer.java | 44 ++++++++--------------
webapps/docs/changelog.xml | 6 ++-
2 files changed, 20 insertions(+), 30 deletions(-)
diff --git a/java/org/apache/catalina/manager/StatusTransformer.java
b/java/org/apache/catalina/manager/StatusTransformer.java
index bf0ab3d75c..70fbedea0e 100644
--- a/java/org/apache/catalina/manager/StatusTransformer.java
+++ b/java/org/apache/catalina/manager/StatusTransformer.java
@@ -34,7 +34,6 @@ import javax.management.ObjectName;
import jakarta.servlet.http.HttpServletResponse;
-import org.apache.catalina.LifecycleState;
import org.apache.tomcat.util.json.JSONFilter;
import org.apache.tomcat.util.security.Escape;
@@ -796,8 +795,6 @@ public class StatusTransformer {
contextName = "";
}
- Object stateName = mBeanServer.getAttribute(objectName, "stateName");
-
if (mode == 0) {
writer.print("<h1>");
@@ -806,19 +803,14 @@ public class StatusTransformer {
writer.print("</a>");
writer.print("<p>");
- writer.print("State: " + stateName);
- if (!LifecycleState.FAILED.name().equals(stateName)) {
- /*
- * If in the FAILED state, the context will be an instance of
FailedContext so the attributes normally
- * requested for a running context won't be available.
- */
- Object startTime = mBeanServer.getAttribute(objectName,
"startTime");
- writer.print(" Start time: " + new Date(((Long)
startTime).longValue()));
- writer.print(" Startup time: ");
- writer.print(formatTime(mBeanServer.getAttribute(objectName,
"startupTime"), false));
- writer.print(" TLD scan time: ");
- writer.print(formatTime(mBeanServer.getAttribute(objectName,
"tldScanTime"), false));
- }
+ writer.print("State: ");
+ writer.print(mBeanServer.getAttribute(objectName, "stateName"));
+ Object startTime = mBeanServer.getAttribute(objectName,
"startTime");
+ writer.print(" Start time: " + new Date(((Long)
startTime).longValue()));
+ writer.print(" Startup time: ");
+ writer.print(formatTime(mBeanServer.getAttribute(objectName,
"startupTime"), false));
+ writer.print(" TLD scan time: ");
+ writer.print(formatTime(mBeanServer.getAttribute(objectName,
"tldScanTime"), false));
if (managerON != null) {
writeManager(writer, managerON, mBeanServer, mode);
}
@@ -839,19 +831,13 @@ public class StatusTransformer {
} else if (mode == 2) {
indent(writer, 2).append('{').println();
appendJSonValue(indent(writer, 3), "name",
JSONFilter.escape(JSONFilter.escape(name))).append(',');
- appendJSonValue(writer, "stateName", stateName);
- if (!LifecycleState.FAILED.name().equals(stateName)) {
- /*
- * If in the FAILED state, the context will be an instance of
FailedContext so the attributes normally
- * requested for a running context won't be available.
- */
- writer.append(',');
- appendJSonValue(writer, "startTime",
- new Date(((Long) mBeanServer.getAttribute(objectName,
"startTime")).longValue()).toString())
- .append(',');
- appendJSonValue(writer, "startupTime",
mBeanServer.getAttribute(objectName, "startupTime")).append(',');
- appendJSonValue(writer, "tldScanTime",
mBeanServer.getAttribute(objectName, "tldScanTime"));
- }
+ appendJSonValue(writer, "state",
mBeanServer.getAttribute(objectName, "stateName"));
+ writer.append(',');
+ appendJSonValue(writer, "startTime",
+ new Date(((Long) mBeanServer.getAttribute(objectName,
"startTime")).longValue()).toString())
+ .append(',');
+ appendJSonValue(writer, "startupTime",
mBeanServer.getAttribute(objectName, "startupTime")).append(',');
+ appendJSonValue(writer, "tldScanTime",
mBeanServer.getAttribute(objectName, "tldScanTime"));
if (managerON != null) {
writeManager(writer, managerON, mBeanServer, mode);
}
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 0923e3c935..360d80a654 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -307,8 +307,12 @@
<fix>
Manager: Fix abrupt truncation of the HTML and JSON complete server
status output if one or more of the web applications failed to start.
- (markt)
+ (schultz)
</fix>
+ <add>
+ Manager: Include web application state in the HTML and JSON complete
+ server status output. (markt)
+ </add>
</changelog>
</subsection>
<subsection name="Other">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]