This is an automated email from the ASF dual-hosted git repository.

markt pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/9.0.x by this push:
     new 0cf53edcdf Add the ability to set a sub-title for the Manager main page
0cf53edcdf is described below

commit 0cf53edcdf96276a0c46077c2df6230924b8ad37
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Wed Jun 12 12:55:26 2024 +0100

    Add the ability to set a sub-title for the Manager main page
    
    This is intended to allow users with lots of instances to easily
    distinguish them. Based on pull request #724 by Simon Arame.
---
 .../apache/catalina/manager/HTMLManagerServlet.java   |  6 ++++++
 webapps/docs/changelog.xml                            | 10 ++++++++++
 webapps/docs/manager-howto.xml                        | 19 +++++++++++++++++++
 webapps/manager/WEB-INF/web.xml                       |  7 +++++++
 4 files changed, 42 insertions(+)

diff --git a/java/org/apache/catalina/manager/HTMLManagerServlet.java 
b/java/org/apache/catalina/manager/HTMLManagerServlet.java
index fd6e60197a..be540906c2 100644
--- a/java/org/apache/catalina/manager/HTMLManagerServlet.java
+++ b/java/org/apache/catalina/manager/HTMLManagerServlet.java
@@ -82,6 +82,7 @@ public final class HTMLManagerServlet extends ManagerServlet {
     static final String connectorTrustedCertsJspPath = 
"/WEB-INF/jsp/connectorTrustedCerts.jsp";
 
     private boolean showProxySessions = false;
+    private String htmlSubTitle = null;
 
     // --------------------------------------------------------- Public Methods
 
@@ -303,6 +304,9 @@ public final class HTMLManagerServlet extends 
ManagerServlet {
         Object[] args = new Object[2];
         args[0] = getServletContext().getContextPath();
         args[1] = smClient.getString("htmlManagerServlet.title");
+        if (htmlSubTitle != null) {
+            args[1] += "</font><br/><font size=\"+1\">" + htmlSubTitle;
+        }
 
         // HTML Header Section
         writer.print(MessageFormat.format(Constants.HTML_HEADER_SECTION, 
args));
@@ -737,6 +741,8 @@ public final class HTMLManagerServlet extends 
ManagerServlet {
         String value = null;
         value = getServletConfig().getInitParameter("showProxySessions");
         showProxySessions = Boolean.parseBoolean(value);
+
+        htmlSubTitle = getServletConfig().getInitParameter("htmlSubTitle");
     }
 
     // ------------------------------------------------ Sessions administration
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 7d8285ae41..1118507866 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -164,6 +164,16 @@
       </fix>
     </changelog>
   </subsection>
+  <subsection name="Web applications">
+    <changelog>
+      <add>
+        Add the ability to set a sub-title for the Manager web application main
+        page. This is intended to allow users with lots of instances to easily
+        distinguish them. Based on pull request <pr>724</pr> by Simon Arame.
+        (markt)
+      </add>
+    </changelog>
+  </subsection>
   <subsection name="Other">
     <changelog>
       <update>
diff --git a/webapps/docs/manager-howto.xml b/webapps/docs/manager-howto.xml
index e6a5f59afc..54d5f4d7f0 100644
--- a/webapps/docs/manager-howto.xml
+++ b/webapps/docs/manager-howto.xml
@@ -237,6 +237,25 @@ action does not have correct value of the token, the 
action will be denied.
 If the token has expired you can start again from the main page or
 <em>List Applications</em> page of Manager.</p>
 
+<p>To customize the subtitle of the HTML interface of the Manager web 
application,
+you can add any valid xml escaped html code to the <code>htmlSubTitle</code>
+initialisation parameter of the <code>HTMLManagerServlet</code>
+</p>
+
+<source><![CDATA[<servlet>
+  <servlet-name>HTMLManager</servlet-name>
+  <servlet-class>org.apache.catalina.manager.HTMLManagerServlet</servlet-class>
+  <init-param>
+    <param-name>htmlSubTitle</param-name>
+    <param-value>Company Inc.&lt;br&gt;&lt;i 
style=&apos;color:red&apos;&gt;Staging&lt;/i&gt;</param-value>
+  </init-param>
+  ...
+</servlet>]]></source>
+
+<p>The above string value would unescape and be appended to the title</p>
+
+<source><![CDATA[Company Inc.<br><i style='color:red'>Staging</i>]]></source>
+
 </section>
 
 <section name="Supported Manager Commands">
diff --git a/webapps/manager/WEB-INF/web.xml b/webapps/manager/WEB-INF/web.xml
index 5e84ba260b..1426f41d74 100644
--- a/webapps/manager/WEB-INF/web.xml
+++ b/webapps/manager/WEB-INF/web.xml
@@ -52,6 +52,13 @@
       <param-value>true</param-value>
     </init-param>
     -->
+    <!-- Uncomment this to set a sub-title for the manager web application main
+         page. It must be XML escaped, valid HTML.
+    <init-param>
+      <param-name>htmlSubTitle</param-name>
+      <param-value>Sub-Title</param-value>
+    </init-param>
+    -->
     <multipart-config>
       <!-- 50 MiB max -->
       <max-file-size>52428800</max-file-size>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to