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 c1573e4191 Add the ability to set a sub-title for the Manager main page c1573e4191 is described below commit c1573e419117cf796ba54002c05b180eb6f12f37 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 d54f754546..6a8f3ffcbe 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 132a3ffb3c..8d5b6fc599 100644 --- a/webapps/docs/changelog.xml +++ b/webapps/docs/changelog.xml @@ -160,6 +160,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 f21ac584d3..f9678f415e 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.<br><i style='color:red'>Staging</i></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 a5332d59d8..ae8aeb9e4f 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