Skip to content

Commit

Permalink
Add the ability to set a sub-title for the Manager main page
Browse files Browse the repository at this point in the history
This is intended to allow users with lots of instances to easily
distinguish them. Based on pull request #724 by Simon Arame.
  • Loading branch information
markt-asf committed Jun 12, 2024
1 parent 9c65807 commit c1573e4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions java/org/apache/catalina/manager/HTMLManagerServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -303,6 +304,9 @@ protected void list(HttpServletRequest request, HttpServletResponse response, St
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));
Expand Down Expand Up @@ -737,6 +741,8 @@ public void init() throws ServletException {
String value = null;
value = getServletConfig().getInitParameter("showProxySessions");
showProxySessions = Boolean.parseBoolean(value);

htmlSubTitle = getServletConfig().getInitParameter("htmlSubTitle");
}

// ------------------------------------------------ Sessions administration
Expand Down
10 changes: 10 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
19 changes: 19 additions & 0 deletions webapps/docs/manager-howto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
7 changes: 7 additions & 0 deletions webapps/manager/WEB-INF/web.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit c1573e4

Please sign in to comment.