This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 8.5.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/8.5.x by this push:
new 3fa0789a87 Align with 9.0.x onwards
3fa0789a87 is described below
commit 3fa0789a87d3c1c397e1db148d6bffac3a0a878b
Author: Mark Thomas <[email protected]>
AuthorDate: Thu Sep 21 16:30:28 2023 +0100
Align with 9.0.x onwards
---
.../catalina/manager/HTMLManagerServlet.java | 404 +++++++++------------
.../apache/catalina/manager/JMXProxyServlet.java | 2 +-
.../catalina/manager/LocalStrings.properties | 13 +
.../catalina/manager/LocalStrings_fr.properties | 13 +
.../catalina/manager/LocalStrings_ja.properties | 13 +
.../catalina/manager/LocalStrings_ko.properties | 13 +
.../catalina/manager/LocalStrings_zh_CN.properties | 13 +
.../apache/catalina/manager/ManagerServlet.java | 28 +-
.../catalina/manager/StatusManagerServlet.java | 10 +-
.../apache/catalina/manager/StatusTransformer.java | 32 +-
.../apache/catalina/manager/util/SessionUtils.java | 2 +-
11 files changed, 267 insertions(+), 276 deletions(-)
diff --git a/java/org/apache/catalina/manager/HTMLManagerServlet.java
b/java/org/apache/catalina/manager/HTMLManagerServlet.java
index 0297565b9f..82aacb3506 100644
--- a/java/org/apache/catalina/manager/HTMLManagerServlet.java
+++ b/java/org/apache/catalina/manager/HTMLManagerServlet.java
@@ -53,24 +53,20 @@ import org.apache.tomcat.util.res.StringManager;
import org.apache.tomcat.util.security.Escape;
/**
- * Servlet that enables remote management of the web applications deployed
- * within the same virtual host as this web application is. Normally, this
- * functionality will be protected by a security constraint in the web
- * application deployment descriptor. However, this requirement can be
- * relaxed during testing.
+ * Servlet that enables remote management of the web applications deployed
within the same virtual host as this web
+ * application is. Normally, this functionality will be protected by a
security constraint in the web application
+ * deployment descriptor. However, this requirement can be relaxed during
testing.
* <p>
- * The difference between the <code>ManagerServlet</code> and this
- * Servlet is that this Servlet prints out a HTML interface which
- * makes it easier to administrate.
+ * The difference between the <code>ManagerServlet</code> and this Servlet is
that this Servlet prints out an HTML
+ * interface which makes it easier to administrate.
* <p>
- * However if you use a software that parses the output of
- * <code>ManagerServlet</code> you won't be able to upgrade
- * to this Servlet since the output are not in the
- * same format ar from <code>ManagerServlet</code>
+ * However if you use a software that parses the output of
<code>ManagerServlet</code> you won't be able to upgrade to
+ * this Servlet since the output are not in the same format ar from
<code>ManagerServlet</code>
*
* @author Bip Thelin
* @author Malcolm Edgar
* @author Glenn L. Nielsen
+ *
* @see ManagerServlet
*/
public final class HTMLManagerServlet extends ManagerServlet {
@@ -93,19 +89,16 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Process a GET request for the specified resource.
*
- * @param request The servlet request we are processing
+ * @param request The servlet request we are processing
* @param response The servlet response we are creating
*
- * @exception IOException if an input/output error occurs
+ * @exception IOException if an input/output error occurs
* @exception ServletException if a servlet-specified error occurs
*/
@Override
- public void doGet(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
+ public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
- StringManager smClient = StringManager.getManager(
- Constants.Package, request.getLocales());
+ StringManager smClient = StringManager.getManager(Constants.Package,
request.getLocales());
// Identify the request parameters that we need
// By obtaining the command from the pathInfo, per-command security can
@@ -132,9 +125,8 @@ public final class HTMLManagerServlet extends
ManagerServlet {
doSessions(cn, request, response, smClient);
return;
} catch (Exception e) {
- log("HTMLManagerServlet.sessions[" + cn + "]", e);
- message = smClient.getString("managerServlet.exception",
- e.toString());
+ log(sm.getString("htmlManagerServlet.error.sessions", cn), e);
+ message = smClient.getString("managerServlet.exception",
e.toString());
}
} else if (command.equals("/sslConnectorCiphers")) {
sslConnectorCiphers(request, response, smClient);
@@ -142,15 +134,12 @@ public final class HTMLManagerServlet extends
ManagerServlet {
sslConnectorCerts(request, response, smClient);
} else if (command.equals("/sslConnectorTrustedCerts")) {
sslConnectorTrustedCerts(request, response, smClient);
- } else if (command.equals("/upload") || command.equals("/deploy") ||
- command.equals("/reload") || command.equals("/undeploy") ||
- command.equals("/expire") || command.equals("/start") ||
+ } else if (command.equals("/upload") || command.equals("/deploy") ||
command.equals("/reload") ||
+ command.equals("/undeploy") || command.equals("/expire") ||
command.equals("/start") ||
command.equals("/stop")) {
- message =
- smClient.getString("managerServlet.postCommand", command);
+ message = smClient.getString("managerServlet.postCommand",
command);
} else {
- message =
- smClient.getString("managerServlet.unknownCommand", command);
+ message = smClient.getString("managerServlet.unknownCommand",
command);
}
list(request, response, message, smClient);
@@ -159,19 +148,16 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Process a POST request for the specified resource.
*
- * @param request The servlet request we are processing
+ * @param request The servlet request we are processing
* @param response The servlet response we are creating
*
- * @exception IOException if an input/output error occurs
+ * @exception IOException if an input/output error occurs
* @exception ServletException if a servlet-specified error occurs
*/
@Override
- public void doPost(HttpServletRequest request,
- HttpServletResponse response)
- throws IOException, ServletException {
+ public void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
- StringManager smClient = StringManager.getManager(
- Constants.Package, request.getLocales());
+ StringManager smClient = StringManager.getManager(Constants.Package,
request.getLocales());
// Identify the request parameters that we need
// By obtaining the command from the pathInfo, per-command security can
@@ -183,11 +169,11 @@ public final class HTMLManagerServlet extends
ManagerServlet {
if (path != null) {
cn = new ContextName(path, request.getParameter("version"));
}
+
String deployPath = request.getParameter("deployPath");
ContextName deployCn = null;
if (deployPath != null) {
- deployCn = new ContextName(deployPath,
- request.getParameter("deployVersion"));
+ deployCn = new ContextName(deployPath,
request.getParameter("deployVersion"));
}
String deployConfig = request.getParameter("deployConfig");
String deployWar = request.getParameter("deployWar");
@@ -204,8 +190,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
} else if (command.equals("/upload")) {
message = upload(request, smClient);
} else if (command.equals("/deploy")) {
- message = deployInternal(deployConfig, deployCn, deployWar,
- smClient);
+ message = deployInternal(deployConfig, deployCn, deployWar,
smClient);
} else if (command.equals("/reload")) {
message = reload(cn, smClient);
} else if (command.equals("/undeploy")) {
@@ -222,7 +207,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
message = sslReload(tlsHostName, smClient);
} else {
// Try GET
- doGet(request,response);
+ doGet(request, response);
return;
}
@@ -237,43 +222,35 @@ public final class HTMLManagerServlet extends
ManagerServlet {
while (true) {
Part warPart = request.getPart("deployWar");
if (warPart == null) {
- message = smClient.getString(
- "htmlManagerServlet.deployUploadNoFile");
+ message =
smClient.getString("htmlManagerServlet.deployUploadNoFile");
break;
}
String filename = warPart.getSubmittedFileName();
if (filename == null ||
!filename.toLowerCase(Locale.ENGLISH).endsWith(".war")) {
- message = smClient.getString(
- "htmlManagerServlet.deployUploadNotWar", filename);
+ message =
smClient.getString("htmlManagerServlet.deployUploadNotWar", filename);
break;
}
// Get the filename if uploaded name includes a path
if (filename.lastIndexOf('\\') >= 0) {
- filename =
- filename.substring(filename.lastIndexOf('\\') + 1);
+ filename = filename.substring(filename.lastIndexOf('\\') +
1);
}
if (filename.lastIndexOf('/') >= 0) {
- filename =
- filename.substring(filename.lastIndexOf('/') + 1);
+ filename = filename.substring(filename.lastIndexOf('/') +
1);
}
// Identify the appBase of the owning Host of this Context
// (if any)
File file = new File(host.getAppBaseFile(), filename);
if (file.exists()) {
- message = smClient.getString(
- "htmlManagerServlet.deployUploadWarExists",
- filename);
+ message =
smClient.getString("htmlManagerServlet.deployUploadWarExists", filename);
break;
}
ContextName cn = new ContextName(filename, true);
String name = cn.getName();
- if ((host.findChild(name) != null) && !isDeployed(name)) {
- message = smClient.getString(
- "htmlManagerServlet.deployUploadInServerXml",
- filename);
+ if (host.findChild(name) != null && !isDeployed(name)) {
+ message =
smClient.getString("htmlManagerServlet.deployUploadInServerXml", filename);
break;
}
@@ -290,26 +267,24 @@ public final class HTMLManagerServlet extends
ManagerServlet {
}
break;
}
- } catch(Exception e) {
- message = smClient.getString
- ("htmlManagerServlet.deployUploadFail", e.getMessage());
+ } catch (Exception e) {
+ message =
smClient.getString("htmlManagerServlet.deployUploadFail", e.getMessage());
log(message, e);
}
return message;
}
/**
- * Deploy an application for the specified path from the specified
- * web application archive.
+ * Deploy an application for the specified path from the specified web
application archive.
*
- * @param config URL of the context configuration file to be deployed
- * @param cn Name of the application to be deployed
- * @param war URL of the web application archive to be deployed
+ * @param config URL of the context configuration file to be deployed
+ * @param cn Name of the application to be deployed
+ * @param war URL of the web application archive to be deployed
* @param smClient internationalized strings
+ *
* @return message String
*/
- protected String deployInternal(String config, ContextName cn, String war,
- StringManager smClient) {
+ protected String deployInternal(String config, ContextName cn, String war,
StringManager smClient) {
StringWriter stringWriter = new StringWriter();
PrintWriter printWriter = new PrintWriter(stringWriter);
@@ -320,23 +295,21 @@ public final class HTMLManagerServlet extends
ManagerServlet {
}
/**
- * Render a HTML list of the currently active Contexts in our virtual host,
- * and memory and server status information.
+ * Render an HTML list of the currently active Contexts in our virtual
host, and memory and server status
+ * information.
*
- * @param request The request
+ * @param request The request
* @param response The response
- * @param message a message to display
+ * @param message a message to display
* @param smClient internationalized strings
+ *
* @throws IOException an IO error occurred
*/
- protected void list(HttpServletRequest request,
- HttpServletResponse response,
- String message,
- StringManager smClient) throws IOException {
+ protected void list(HttpServletRequest request, HttpServletResponse
response, String message,
+ StringManager smClient) throws IOException {
if (debug >= 1) {
- log("list: Listing contexts for virtual host '" +
- host.getName() + "'");
+ log("list: Listing contexts for virtual host '" + host.getName() +
"'");
}
PrintWriter writer = response.getWriter();
@@ -346,13 +319,10 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[1] = smClient.getString("htmlManagerServlet.title");
// HTML Header Section
- writer.print(MessageFormat.format(
- Constants.HTML_HEADER_SECTION, args
- ));
+ writer.print(MessageFormat.format(Constants.HTML_HEADER_SECTION,
args));
// Body Header Section
- writer.print(MessageFormat.format
- (Constants.BODY_HEADER_SECTION, args));
+ writer.print(MessageFormat.format(Constants.BODY_HEADER_SECTION,
args));
// Message Section
args = new Object[3];
@@ -370,15 +340,13 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[1] = response.encodeURL(getServletContext().getContextPath() +
"/html/list");
args[2] = smClient.getString("htmlManagerServlet.list");
args[3] = // External link
- (getServletContext().getContextPath() + "/" +
- smClient.getString("htmlManagerServlet.helpHtmlManagerFile"));
+ getServletContext().getContextPath() + "/" +
+
smClient.getString("htmlManagerServlet.helpHtmlManagerFile");
args[4] = smClient.getString("htmlManagerServlet.helpHtmlManager");
args[5] = // External link
- (getServletContext().getContextPath() + "/" +
- smClient.getString("htmlManagerServlet.helpManagerFile"));
+ getServletContext().getContextPath() + "/" +
smClient.getString("htmlManagerServlet.helpManagerFile");
args[6] = smClient.getString("htmlManagerServlet.helpManager");
- args[7] = response.encodeURL
- (getServletContext().getContextPath() + "/status");
+ args[7] = response.encodeURL(getServletContext().getContextPath() +
"/status");
args[8] = smClient.getString("statusServlet.title");
writer.print(MessageFormat.format(Constants.MANAGER_SECTION, args));
@@ -406,11 +374,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
String appsStart = smClient.getString("htmlManagerServlet.appsStart");
String appsStop = smClient.getString("htmlManagerServlet.appsStop");
String appsReload =
smClient.getString("htmlManagerServlet.appsReload");
- String appsUndeploy =
- smClient.getString("htmlManagerServlet.appsUndeploy");
+ String appsUndeploy =
smClient.getString("htmlManagerServlet.appsUndeploy");
String appsExpire =
smClient.getString("htmlManagerServlet.appsExpire");
- String noVersion = "<i>" +
- smClient.getString("htmlManagerServlet.noVersion") + "</i>";
+ String noVersion = "<i>" +
smClient.getString("htmlManagerServlet.noVersion") + "</i>";
boolean isHighlighted = true;
boolean isDeployed = true;
@@ -422,7 +388,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
if (ctxt != null) {
// Bugzilla 34818, alternating row colors
isHighlighted = !isHighlighted;
- if(isHighlighted) {
+ if (isHighlighted) {
highlightColor = "#C3F3C3";
} else {
highlightColor = "#FFFFFF";
@@ -440,8 +406,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
final String webappVersion = ctxt.getWebappVersion();
if (webappVersion != null && webappVersion.length() > 0) {
tmp.append("&version=");
- tmp.append(URLEncoder.DEFAULT.encode(
- webappVersion, StandardCharsets.UTF_8));
+ tmp.append(URLEncoder.DEFAULT.encode(webappVersion,
StandardCharsets.UTF_8));
}
String pathVersion = tmp.toString();
@@ -454,10 +419,8 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args = new Object[7];
args[0] = // External link
- "<a href=\""
- + URLEncoder.DEFAULT.encode(contextPath + "/",
StandardCharsets.UTF_8)
- + "\" " + Constants.REL_EXTERNAL + ">"
- + Escape.htmlElementContent(displayPath) + "</a>";
+ "<a href=\"" + URLEncoder.DEFAULT.encode(contextPath +
"/", StandardCharsets.UTF_8) + "\" " +
+ Constants.REL_EXTERNAL + ">" +
Escape.htmlElementContent(displayPath) + "</a>";
if (webappVersion == null || webappVersion.isEmpty()) {
args[1] = noVersion;
} else {
@@ -469,13 +432,12 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[2] = Escape.htmlElementContent(ctxt.getDisplayName());
}
args[3] = Boolean.valueOf(ctxt.getState().isAvailable());
- args[4] =
Escape.htmlElementContent(response.encodeURL(getServletContext().getContextPath()
+
- "/html/sessions?" + pathVersion));
+ args[4] = Escape.htmlElementContent(
+
response.encodeURL(getServletContext().getContextPath() + "/html/sessions?" +
pathVersion));
Manager manager = ctxt.getManager();
if (manager instanceof DistributedManager &&
showProxySessions) {
- args[5] = Integer.valueOf(
-
((DistributedManager)manager).getActiveSessionsFull());
- } else if (manager != null){
+ args[5] = Integer.valueOf(((DistributedManager)
manager).getActiveSessionsFull());
+ } else if (manager != null) {
args[5] = Integer.valueOf(manager.getActiveSessions());
} else {
args[5] = Integer.valueOf(0);
@@ -483,24 +445,23 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[6] = highlightColor;
- writer.print
- (MessageFormat.format(APPS_ROW_DETAILS_SECTION, args));
+ writer.print(MessageFormat.format(APPS_ROW_DETAILS_SECTION,
args));
args = new Object[14];
- args[0] = Escape.htmlElementContent(response.encodeURL(request
- .getContextPath() + "/html/start?" + pathVersion));
+ args[0] = Escape.htmlElementContent(
+ response.encodeURL(request.getContextPath() +
"/html/start?" + pathVersion));
args[1] = appsStart;
- args[2] = Escape.htmlElementContent(response.encodeURL(request
- .getContextPath() + "/html/stop?" + pathVersion));
+ args[2] = Escape
+
.htmlElementContent(response.encodeURL(request.getContextPath() + "/html/stop?"
+ pathVersion));
args[3] = appsStop;
- args[4] = Escape.htmlElementContent(response.encodeURL(request
- .getContextPath() + "/html/reload?" + pathVersion));
+ args[4] = Escape.htmlElementContent(
+ response.encodeURL(request.getContextPath() +
"/html/reload?" + pathVersion));
args[5] = appsReload;
- args[6] = Escape.htmlElementContent(response.encodeURL(request
- .getContextPath() + "/html/undeploy?" + pathVersion));
+ args[6] = Escape.htmlElementContent(
+ response.encodeURL(request.getContextPath() +
"/html/undeploy?" + pathVersion));
args[7] = appsUndeploy;
- args[8] = Escape.htmlElementContent(response.encodeURL(request
- .getContextPath() + "/html/expire?" + pathVersion));
+ args[8] = Escape.htmlElementContent(
+ response.encodeURL(request.getContextPath() +
"/html/expire?" + pathVersion));
args[9] = appsExpire;
args[10] =
smClient.getString("htmlManagerServlet.expire.explain");
if (manager == null) {
@@ -512,20 +473,15 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[13] = highlightColor;
if (ctxt.getName().equals(this.context.getName())) {
- writer.print(MessageFormat.format(
- MANAGER_APP_ROW_BUTTON_SECTION, args));
+
writer.print(MessageFormat.format(MANAGER_APP_ROW_BUTTON_SECTION, args));
} else if (ctxt.getState().isAvailable() && isDeployed) {
- writer.print(MessageFormat.format(
- STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+
writer.print(MessageFormat.format(STARTED_DEPLOYED_APPS_ROW_BUTTON_SECTION,
args));
} else if (ctxt.getState().isAvailable() && !isDeployed) {
- writer.print(MessageFormat.format(
- STARTED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+
writer.print(MessageFormat.format(STARTED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION,
args));
} else if (!ctxt.getState().isAvailable() && isDeployed) {
- writer.print(MessageFormat.format(
- STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+
writer.print(MessageFormat.format(STOPPED_DEPLOYED_APPS_ROW_BUTTON_SECTION,
args));
} else {
- writer.print(MessageFormat.format(
- STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION, args));
+
writer.print(MessageFormat.format(STOPPED_NONDEPLOYED_APPS_ROW_BUTTON_SECTION,
args));
}
}
@@ -562,21 +518,17 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args = new Object[15];
args[0] = smClient.getString("htmlManagerServlet.diagnosticsTitle");
args[1] = smClient.getString("htmlManagerServlet.diagnosticsLeak");
- args[2] = response.encodeURL(
- getServletContext().getContextPath() + "/html/findleaks");
+ args[2] = response.encodeURL(getServletContext().getContextPath() +
"/html/findleaks");
args[3] =
smClient.getString("htmlManagerServlet.diagnosticsLeakWarning");
args[4] =
smClient.getString("htmlManagerServlet.diagnosticsLeakButton");
args[5] = smClient.getString("htmlManagerServlet.diagnosticsSsl");
- args[6] = response.encodeURL(
- getServletContext().getContextPath() +
"/html/sslConnectorCiphers");
+ args[6] = response.encodeURL(getServletContext().getContextPath() +
"/html/sslConnectorCiphers");
args[7] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorCipherButton");
args[8] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorCipherText");
- args[9] = response.encodeURL(
- getServletContext().getContextPath() +
"/html/sslConnectorCerts");
+ args[9] = response.encodeURL(getServletContext().getContextPath() +
"/html/sslConnectorCerts");
args[10] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorCertsButton");
args[11] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorCertsText");
- args[12] = response.encodeURL(
- getServletContext().getContextPath() +
"/html/sslConnectorTrustedCerts");
+ args[12] = response.encodeURL(getServletContext().getContextPath() +
"/html/sslConnectorTrustedCerts");
args[13] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton");
args[14] =
smClient.getString("htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText");
writer.print(MessageFormat.format(DIAGNOSTICS_SECTION, args));
@@ -592,8 +544,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
args[6] = smClient.getString("htmlManagerServlet.serverOSArch");
args[7] = smClient.getString("htmlManagerServlet.serverHostname");
args[8] = smClient.getString("htmlManagerServlet.serverIPAddress");
- writer.print(MessageFormat.format
- (Constants.SERVER_HEADER_SECTION, args));
+ writer.print(MessageFormat.format(Constants.SERVER_HEADER_SECTION,
args));
// Server Row Section
args = new Object[8];
@@ -626,8 +577,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
*
* @see ManagerServlet#reload(PrintWriter, ContextName, StringManager)
*
- * @param cn Name of the application to be restarted
- * @param smClient StringManager for the client's locale
+ * @param cn Name of the application to be restarted
+ * @param smClient StringManager for the client's locale
+ *
* @return message String
*/
protected String reload(ContextName cn, StringManager smClient) {
@@ -645,8 +597,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
*
* @see ManagerServlet#undeploy(PrintWriter, ContextName, StringManager)
*
- * @param cn Name of the application to be undeployed
- * @param smClient StringManager for the client's locale
+ * @param cn Name of the application to be undeployed
+ * @param smClient StringManager for the client's locale
+ *
* @return message String
*/
protected String undeploy(ContextName cn, StringManager smClient) {
@@ -662,12 +615,12 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Display session information and invoke list.
*
- * @see ManagerServlet#sessions(PrintWriter, ContextName, int,
- * StringManager)
+ * @see ManagerServlet#sessions(PrintWriter, ContextName, int,
StringManager)
+ *
+ * @param cn Name of the application to list session information
+ * @param idle Expire all sessions with idle time ≥ idle for this
context
+ * @param smClient StringManager for the client's locale
*
- * @param cn Name of the application to list session information
- * @param idle Expire all sessions with idle time ≥ idle for this
context
- * @param smClient StringManager for the client's locale
* @return message String
*/
protected String sessions(ContextName cn, int idle, StringManager
smClient) {
@@ -685,8 +638,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
*
* @see ManagerServlet#start(PrintWriter, ContextName, StringManager)
*
- * @param cn Name of the application to be started
- * @param smClient StringManager for the client's locale
+ * @param cn Name of the application to be started
+ * @param smClient StringManager for the client's locale
+ *
* @return message String
*/
protected String start(ContextName cn, StringManager smClient) {
@@ -704,8 +658,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
*
* @see ManagerServlet#stop(PrintWriter, ContextName, StringManager)
*
- * @param cn Name of the application to be stopped
- * @param smClient StringManager for the client's locale
+ * @param cn Name of the application to be stopped
+ * @param smClient StringManager for the client's locale
+ *
* @return message String
*/
protected String stop(ContextName cn, StringManager smClient) {
@@ -723,7 +678,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
*
* @see ManagerServlet#findleaks(boolean, PrintWriter, StringManager)
*
- * @param smClient StringManager for the client's locale
+ * @param smClient StringManager for the client's locale
*
* @return message String
*/
@@ -740,8 +695,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
if (writerText.length() > 0) {
if (!writerText.startsWith("FAIL -")) {
- msg.append(smClient.getString(
- "htmlManagerServlet.findleaksList"));
+
msg.append(smClient.getString("htmlManagerServlet.findleaksList"));
}
msg.append(writerText);
} else {
@@ -762,27 +716,24 @@ public final class HTMLManagerServlet extends
ManagerServlet {
}
- protected void sslConnectorCiphers(HttpServletRequest request,
- HttpServletResponse response, StringManager smClient) throws
ServletException, IOException {
+ protected void sslConnectorCiphers(HttpServletRequest request,
HttpServletResponse response, StringManager smClient)
+ throws ServletException, IOException {
request.setAttribute("cipherList", getConnectorCiphers(smClient));
- getServletContext().getRequestDispatcher(
- connectorCiphersJspPath).forward(request, response);
+
getServletContext().getRequestDispatcher(connectorCiphersJspPath).forward(request,
response);
}
- protected void sslConnectorCerts(HttpServletRequest request,
- HttpServletResponse response, StringManager smClient) throws
ServletException, IOException {
+ protected void sslConnectorCerts(HttpServletRequest request,
HttpServletResponse response, StringManager smClient)
+ throws ServletException, IOException {
request.setAttribute("certList", getConnectorCerts(smClient));
- getServletContext().getRequestDispatcher(
- connectorCertsJspPath).forward(request, response);
+
getServletContext().getRequestDispatcher(connectorCertsJspPath).forward(request,
response);
}
- protected void sslConnectorTrustedCerts(HttpServletRequest request,
- HttpServletResponse response, StringManager smClient) throws
ServletException, IOException {
+ protected void sslConnectorTrustedCerts(HttpServletRequest request,
HttpServletResponse response,
+ StringManager smClient) throws ServletException, IOException {
request.setAttribute("trustedCertList",
getConnectorTrustedCerts(smClient));
- getServletContext().getRequestDispatcher(
- connectorTrustedCertsJspPath).forward(request, response);
+
getServletContext().getRequestDispatcher(connectorTrustedCertsJspPath).forward(request,
response);
}
@@ -812,20 +763,20 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Extract the expiration request parameter
*
- * @param cn Name of the application from which to expire sessions
- * @param req The Servlet request
+ * @param cn Name of the application from which to expire sessions
+ * @param req The Servlet request
* @param smClient StringManager for the client's locale
+ *
* @return message string
*/
- protected String expireSessions(ContextName cn, HttpServletRequest req,
- StringManager smClient) {
+ protected String expireSessions(ContextName cn, HttpServletRequest req,
StringManager smClient) {
int idle = -1;
String idleParam = req.getParameter("idle");
if (idleParam != null) {
try {
idle = Integer.parseInt(idleParam);
} catch (NumberFormatException e) {
- log("Could not parse idle parameter to an int: " + idleParam);
+ log(sm.getString("managerServlet.error.idleParam", idleParam));
}
}
return sessions(cn, idle, smClient);
@@ -834,22 +785,21 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Handle session operations.
*
- * @param cn Name of the application for the sessions operation
- * @param req The Servlet request
- * @param resp The Servlet response
+ * @param cn Name of the application for the sessions operation
+ * @param req The Servlet request
+ * @param resp The Servlet response
* @param smClient StringManager for the client's locale
+ *
* @throws ServletException Propagated Servlet error
- * @throws IOException An IO error occurred
+ * @throws IOException An IO error occurred
*/
- protected void doSessions(ContextName cn, HttpServletRequest req,
- HttpServletResponse resp, StringManager smClient)
+ protected void doSessions(ContextName cn, HttpServletRequest req,
HttpServletResponse resp, StringManager smClient)
throws ServletException, IOException {
req.setAttribute("path", cn.getPath());
req.setAttribute("version", cn.getVersion());
String action = req.getParameter("action");
if (debug >= 1) {
- log("sessions: Session action '" + action +
- "' for web application '" + cn.getDisplayName() + "'");
+ log("sessions: Session action '" + action + "' for web application
'" + cn.getDisplayName() + "'");
}
if ("sessionDetail".equals(action)) {
String sessionId = req.getParameter("sessionId");
@@ -862,9 +812,9 @@ public final class HTMLManagerServlet extends
ManagerServlet {
} else if ("removeSessionAttribute".equals(action)) {
String sessionId = req.getParameter("sessionId");
String name = req.getParameter("attributeName");
- boolean removed =
- removeSessionAttribute(cn, sessionId, name, smClient);
- String outMessage = removed ? "Session attribute '" + name + "'
removed." : "Session did not contain any attribute named '" + name + "'";
+ boolean removed = removeSessionAttribute(cn, sessionId, name,
smClient);
+ String outMessage = removed ? "Session attribute '" + name + "'
removed." :
+ "Session did not contain any attribute named '" + name +
"'";
req.setAttribute(APPLICATION_MESSAGE, outMessage);
displaySessionDetailPage(req, resp, cn, sessionId, smClient);
return;
@@ -872,31 +822,26 @@ public final class HTMLManagerServlet extends
ManagerServlet {
displaySessionsListPage(cn, req, resp, smClient);
}
- protected List<Session> getSessionsForName(ContextName cn,
- StringManager smClient) {
- if ((cn == null) || !(cn.getPath().startsWith("/") ||
- cn.getPath().equals(""))) {
+ protected List<Session> getSessionsForName(ContextName cn, StringManager
smClient) {
+ if (cn == null || !(cn.getPath().startsWith("/") ||
cn.getPath().equals(""))) {
String path = null;
if (cn != null) {
path = cn.getPath();
}
- throw new IllegalArgumentException(smClient.getString(
- "managerServlet.invalidPath",
- Escape.htmlElementContent(path)));
+ throw new IllegalArgumentException(
+ smClient.getString("managerServlet.invalidPath",
Escape.htmlElementContent(path)));
}
Context ctxt = (Context) host.findChild(cn.getName());
if (null == ctxt) {
- throw new IllegalArgumentException(smClient.getString(
- "managerServlet.noContext",
- Escape.htmlElementContent(cn.getDisplayName())));
+ throw new IllegalArgumentException(
+ smClient.getString("managerServlet.noContext",
Escape.htmlElementContent(cn.getDisplayName())));
}
Manager manager = ctxt.getManager();
List<Session> sessions = new
ArrayList<>(Arrays.asList(manager.findSessions()));
if (manager instanceof DistributedManager && showProxySessions) {
// Add dummy proxy sessions
- Set<String> sessionIds =
- ((DistributedManager) manager).getSessionIdsFull();
+ Set<String> sessionIds = ((DistributedManager)
manager).getSessionIdsFull();
// Remove active (primary and backup) session IDs from full list
for (Session session : sessions) {
sessionIds.remove(session.getId());
@@ -909,14 +854,13 @@ public final class HTMLManagerServlet extends
ManagerServlet {
return sessions;
}
- protected Session getSessionForNameAndId(ContextName cn, String id,
- StringManager smClient) {
+ protected Session getSessionForNameAndId(ContextName cn, String id,
StringManager smClient) {
List<Session> sessions = getSessionsForName(cn, smClient);
if (sessions.isEmpty()) {
return null;
}
- for(Session session : sessions) {
+ for (Session session : sessions) {
if (session.getId().equals(id)) {
return session;
}
@@ -926,17 +870,17 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* List session.
- * @param cn Name of the application for which the sessions will be listed
- * @param req The Servlet request
- * @param resp The Servlet response
+ *
+ * @param cn Name of the application for which the sessions will be
listed
+ * @param req The Servlet request
+ * @param resp The Servlet response
* @param smClient StringManager for the client's locale
+ *
* @throws ServletException Propagated Servlet error
- * @throws IOException An IO error occurred
+ * @throws IOException An IO error occurred
*/
- protected void displaySessionsListPage(ContextName cn,
- HttpServletRequest req, HttpServletResponse resp,
- StringManager smClient)
- throws ServletException, IOException {
+ protected void displaySessionsListPage(ContextName cn, HttpServletRequest
req, HttpServletResponse resp,
+ StringManager smClient) throws ServletException, IOException {
List<Session> sessions = getSessionsForName(cn, smClient);
String sortBy = req.getParameter("sort");
String orderBy = null;
@@ -957,14 +901,14 @@ public final class HTMLManagerServlet extends
ManagerServlet {
req.setAttribute(APPLICATION_ERROR, "Can't sort session
list: one session is invalidated");
}
} else {
- log("WARNING: unknown sort order: " + sortBy);
+ log(sm.getString("htmlManagerServlet.error.sortOrder",
sortBy));
}
}
// keep sort order
req.setAttribute("sort", sortBy);
req.setAttribute("order", orderBy);
req.setAttribute("activeSessions", sessions);
- //strong>NOTE</strong> - This header will be overridden
+ // strong>NOTE</strong> - This header will be overridden
// automatically if a <code>RequestDispatcher.forward()</code> call is
// ultimately invoked.
resp.setHeader("Pragma", "No-cache"); // HTTP 1.0
@@ -976,19 +920,19 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Display session details.
*
- * @param req The Servlet request
- * @param resp The Servlet response
- * @param cn Name of the application for which the sessions will be listed
+ * @param req The Servlet request
+ * @param resp The Servlet response
+ * @param cn Name of the application for which the sessions will be
listed
* @param sessionId the session id
- * @param smClient StringManager for the client's locale
+ * @param smClient StringManager for the client's locale
+ *
* @throws ServletException Propagated Servlet error
- * @throws IOException An IO error occurred
+ * @throws IOException An IO error occurred
*/
- protected void displaySessionDetailPage(HttpServletRequest req,
- HttpServletResponse resp, ContextName cn, String sessionId,
- StringManager smClient) throws ServletException, IOException {
+ protected void displaySessionDetailPage(HttpServletRequest req,
HttpServletResponse resp, ContextName cn,
+ String sessionId, StringManager smClient) throws ServletException,
IOException {
Session session = getSessionForNameAndId(cn, sessionId, smClient);
- //strong>NOTE</strong> - This header will be overridden
+ // strong>NOTE</strong> - This header will be overridden
// automatically if a <code>RequestDispatcher.forward()</code> call is
// ultimately invoked.
resp.setHeader("Pragma", "No-cache"); // HTTP 1.0
@@ -1001,14 +945,13 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Invalidate specified sessions.
*
- * @param cn Name of the application for which sessions are to be
- * invalidated
+ * @param cn Name of the application for which sessions are to be
invalidated
* @param sessionIds the session ids of the sessions
- * @param smClient StringManager for the client's locale
+ * @param smClient StringManager for the client's locale
+ *
* @return number of invalidated sessions
*/
- protected int invalidateSessions(ContextName cn, String[] sessionIds,
- StringManager smClient) {
+ protected int invalidateSessions(ContextName cn, String[] sessionIds,
StringManager smClient) {
if (null == sessionIds) {
return 0;
}
@@ -1018,7 +961,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
if (null == session) {
// Shouldn't happen, but let's play nice...
if (debug >= 1) {
- log("WARNING: can't invalidate null session " + sessionId);
+ log("Cannot invalidate null session " + sessionId);
}
continue;
}
@@ -1030,7 +973,7 @@ public final class HTMLManagerServlet extends
ManagerServlet {
}
} catch (IllegalStateException ise) {
if (debug >= 1) {
- log("Can't invalidate already invalidated session id " +
sessionId);
+ log("Cannot invalidate already invalidated session id " +
sessionId);
}
}
}
@@ -1039,30 +982,31 @@ public final class HTMLManagerServlet extends
ManagerServlet {
/**
* Removes an attribute from an HttpSession
- * @param cn Name of the application hosting the session from which the
- * attribute is to be removed
- * @param sessionId the session id
+ *
+ * @param cn Name of the application hosting the session from
which the attribute is to be removed
+ * @param sessionId the session id
* @param attributeName the attribute name
- * @param smClient StringManager for the client's locale
+ * @param smClient StringManager for the client's locale
+ *
* @return true if there was an attribute removed, false otherwise
*/
- protected boolean removeSessionAttribute(ContextName cn, String sessionId,
- String attributeName, StringManager smClient) {
+ protected boolean removeSessionAttribute(ContextName cn, String sessionId,
String attributeName,
+ StringManager smClient) {
Session session = getSessionForNameAndId(cn, sessionId, smClient);
if (null == session) {
// Shouldn't happen, but let's play nice...
if (debug >= 1) {
- log("WARNING: can't remove attribute '" + attributeName + "'
for null session " + sessionId);
+ log("Cannot remove attribute '" + attributeName + "' for null
session " + sessionId);
}
return false;
}
HttpSession httpSession = session.getSession();
- boolean wasPresent = (null != httpSession.getAttribute(attributeName));
+ boolean wasPresent = null != httpSession.getAttribute(attributeName);
try {
httpSession.removeAttribute(attributeName);
} catch (IllegalStateException ise) {
if (debug >= 1) {
- log("Can't remote attribute '" + attributeName + "' for
invalidated session id " + sessionId);
+ log("Cannot remote attribute '" + attributeName + "' for
invalidated session id " + sessionId);
}
}
return wasPresent;
@@ -1141,7 +1085,6 @@ public final class HTMLManagerServlet extends
ManagerServlet {
}
};
}
- //TODO: complete this to TTL, etc.
return comparator;
}
@@ -1434,4 +1377,5 @@ public final class HTMLManagerServlet extends
ManagerServlet {
"</tr>\n" +
"</table>\n" +
"<br>";
+ //@formatter:on
}
diff --git a/java/org/apache/catalina/manager/JMXProxyServlet.java
b/java/org/apache/catalina/manager/JMXProxyServlet.java
index fc2a4cf197..3d8f7c4fcb 100644
--- a/java/org/apache/catalina/manager/JMXProxyServlet.java
+++ b/java/org/apache/catalina/manager/JMXProxyServlet.java
@@ -86,7 +86,7 @@ public class JMXProxyServlet extends HttpServlet {
*/
@Override
public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
- response.setContentType("text/plain");
+ response.setContentType("text/plain;charset=" + Constants.CHARSET);
// Stop older versions of IE thinking they know best. We set text/plain
// in the line above for a reason. IE's behaviour is unwanted at best
// and dangerous at worst.
diff --git a/java/org/apache/catalina/manager/LocalStrings.properties
b/java/org/apache/catalina/manager/LocalStrings.properties
index 1f0e3dec35..caea6ad839 100644
--- a/java/org/apache/catalina/manager/LocalStrings.properties
+++ b/java/org/apache/catalina/manager/LocalStrings.properties
@@ -72,6 +72,8 @@ htmlManagerServlet.diagnosticsSslConnectorCipherText=List the
configured TLS vir
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton=Trusted
Certificates
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText=List the configured
TLS virtual hosts and the trusted certificates for each.
htmlManagerServlet.diagnosticsTitle=Diagnostics
+htmlManagerServlet.error.sessions=Error processing sessions command for
context [{0}]
+htmlManagerServlet.error.sortOrder=Unknown sort order [{0}]
htmlManagerServlet.expire.explain=with idle ≥
htmlManagerServlet.expire.unit=minutes
htmlManagerServlet.findleaksList=The following web applications were stopped
(reloaded, undeployed), but their\n\
@@ -123,6 +125,17 @@ managerServlet.deleteFail=FAIL - Unable to delete [{0}].
The continued presence
managerServlet.deployFailed=FAIL - Failed to deploy application at context
path [{0}]
managerServlet.deployed=OK - Deployed application at context path [{0}]
managerServlet.deployedButNotStarted=FAIL - Deployed application at context
path [{0}] but context failed to start
+managerServlet.error.deploy=Error deploying [{0}]
+managerServlet.error.idleParam=Could not parse integer idle parameter [{0}]
+managerServlet.error.reload=Error reloading [{0}]
+managerServlet.error.resources=Error displaying resources of type [{0}]
+managerServlet.error.serverInfo=Error displaying server information
+managerServlet.error.sessions=Error displaying sessions information for
context [{0}]
+managerServlet.error.start=Error starting [{0}]
+managerServlet.error.stop=Error stopping [{0}]
+managerServlet.error.storeConfig=Error storing configuration
+managerServlet.error.storeContextConfig=Error storing configuration for
context [{0}]
+managerServlet.error.undeploy=Error undeploying [{0}]
managerServlet.exception=FAIL - Encountered exception [{0}]
managerServlet.findleaksFail=FAIL - Find leaks failed: Host not instance of
StandardHost
managerServlet.findleaksList=OK - Found potential memory leaks in the
following applications:
diff --git a/java/org/apache/catalina/manager/LocalStrings_fr.properties
b/java/org/apache/catalina/manager/LocalStrings_fr.properties
index 597b38bf2b..138a86e019 100644
--- a/java/org/apache/catalina/manager/LocalStrings_fr.properties
+++ b/java/org/apache/catalina/manager/LocalStrings_fr.properties
@@ -72,6 +72,8 @@ htmlManagerServlet.diagnosticsSslConnectorCipherText=Lister
les hôtes virtuels
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton=Certificats de
confiance
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText=Lister les hôtes
virtuels TLS configurés et les certificats de confiance utilisés par chacun
htmlManagerServlet.diagnosticsTitle=Diagnostics
+htmlManagerServlet.error.sessions=Erreur lors du traitement de la commande
sessions pour le contexte [{0}]
+htmlManagerServlet.error.sortOrder=Ordre de tri [{0}] inconnu
htmlManagerServlet.expire.explain=inactives depuis ≥
htmlManagerServlet.expire.unit=minutes
htmlManagerServlet.findleaksList=Les applications suivantes ont été arrêtées
(redémarrées, retirées), mais certaines de leurs classes sont toujours
présentes en mémoire, cela pourrait donc causer une fuite de mémoire (utiliser
un profileur pour le confirmer) :
@@ -121,6 +123,17 @@ managerServlet.deleteFail=ECHEC - Impossible de supprimer
[{0}], ce qui pourrait
managerServlet.deployFailed=ECHEC - Echec au déploiement de l''application
pour le chemin de contexte [{0}]
managerServlet.deployed=OK - Application déployée pour le chemin de contexte
[{0}]
managerServlet.deployedButNotStarted=ECHEC - Application déployée pour le
chemin de contexte [{0}] mais le démarrage du contexte a échoué
+managerServlet.error.deploy=Erreur lors du déploiement de [{0}]
+managerServlet.error.idleParam=Impossible d''analyser le paramètre de temps
d''attente maximum [{0}] qui devrait être un nombre entier
+managerServlet.error.reload=Erreur lors du rechargement de [{0}]
+managerServlet.error.resources=Erreur lors de l''affichage des ressources de
type [{0}]
+managerServlet.error.serverInfo=Erreur lors de l'affichage des informations
sur le serveur
+managerServlet.error.sessions=Erreur lors de l''affichage des informations sur
les sessions pour le contexte [{0}]
+managerServlet.error.start=Erreur lors du démarrage de [{0}]
+managerServlet.error.stop=Erreur lors de l''arrêt de [{0}]
+managerServlet.error.storeConfig=Erreur lors de l'enregistrement de la
configuration
+managerServlet.error.storeContextConfig=Erreur lors de l''enregistrement de la
configuration du contexte [{0}]
+managerServlet.error.undeploy=Erreur lors du retrait de [{0}]
managerServlet.exception=ECHEC - L''exception [{0}] a été rencontrée
managerServlet.findleaksFail=ECHEC - Echec de la recherche de fuites, car
l'hôte n'est pas un StandardHost
managerServlet.findleaksList=OK - De possibles fuites de mémoire ont été
trouvées dans les applications suivantes :
diff --git a/java/org/apache/catalina/manager/LocalStrings_ja.properties
b/java/org/apache/catalina/manager/LocalStrings_ja.properties
index 6fd2d12e90..d8ef0e5907 100644
--- a/java/org/apache/catalina/manager/LocalStrings_ja.properties
+++ b/java/org/apache/catalina/manager/LocalStrings_ja.properties
@@ -72,6 +72,8 @@
htmlManagerServlet.diagnosticsSslConnectorCipherText=設定済みのTLS仮想ホ
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton=信頼できる証明書
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText=設定済みのTLS仮想ホストとそれぞれの信頼できる証明書を一覧表示します。
htmlManagerServlet.diagnosticsTitle=診断
+htmlManagerServlet.error.sessions=コンテキスト [{0}] のセッションコマンド処理中のエラー
+htmlManagerServlet.error.sortOrder=不明なソート順[{0}]
htmlManagerServlet.expire.explain=非アクティブ ≥
htmlManagerServlet.expire.unit=分
htmlManagerServlet.findleaksList=次のWebアプリケーションは停止しました (再ロード、配備解除)。\n\
@@ -123,6 +125,17 @@ managerServlet.deleteFail=FAIL - [{0}]を削除できません。 このファ
managerServlet.deployFailed=FAIL - コンテキストパス [{0}] にアプリケーションを配備できません。
managerServlet.deployed=OK - コンテキストパス [{0}] でアプリケーションを配備しました
managerServlet.deployedButNotStarted=FAIL - コンテキストパス [{0}]
にアプリケーションを配備しましたが、コンテキストを開始できませんでした
+managerServlet.error.deploy=[{0}]の配備中のエラー
+managerServlet.error.idleParam=アイドルパラメータ [{0}] を整数として解析できませんでした
+managerServlet.error.reload=[{0}]の再読み込みエラー
+managerServlet.error.resources=タイプ [{0}] のリソース表示中のエラー
+managerServlet.error.serverInfo=サーバー情報表示中のエラー
+managerServlet.error.sessions=コンテキスト [{0}] のセッション情報表示中のエラー
+managerServlet.error.start=[{0}]を開始中のエラー
+managerServlet.error.stop=[{0}]を停止中のエラー
+managerServlet.error.storeConfig=設定保存中のエラー
+managerServlet.error.storeContextConfig=コンテキスト [{0}] の設定保存中のエラー
+managerServlet.error.undeploy=[{0}]の配備解除中のエラー
managerServlet.exception=FAIL - 例外 [{0}] が発生しました
managerServlet.findleaksFail=FAIL - リークを検出できません。Hostは StandardHost
のインスタンスめはありません。
managerServlet.findleaksList=OK - 次のアプリケーションで潜在的なメモリリークが見つかりました:
diff --git a/java/org/apache/catalina/manager/LocalStrings_ko.properties
b/java/org/apache/catalina/manager/LocalStrings_ko.properties
index d366f2378f..3bb2a2ab8f 100644
--- a/java/org/apache/catalina/manager/LocalStrings_ko.properties
+++ b/java/org/apache/catalina/manager/LocalStrings_ko.properties
@@ -71,6 +71,8 @@ htmlManagerServlet.diagnosticsSslConnectorCipherText=설정된 TLS
가상 호스
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton=신뢰되는 인증서들
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText=설정된 TLS 가상 호스트들과
각각을 위한 신뢰되는 인증서들의 목록을 표시합니다.
htmlManagerServlet.diagnosticsTitle=시스템 진단
+htmlManagerServlet.error.sessions=컨텍스트 [{0}]을(를) 위한 sessions 명령 처리 중 오류 발생
+htmlManagerServlet.error.sortOrder=알 수 없는 정렬 순서 [{0}]
htmlManagerServlet.expire.explain=idle 값 ≥
htmlManagerServlet.expire.unit=분
htmlManagerServlet.findleaksList=다음 웹 애플리케이션들이 중지되었지만 (다시 로드되거나, 배치가 제거되어), 이전
실행 시에 로드되었던 클래스들이 여전히 메모리에 남아 있어서, 메모리 누수를 유발할 수 있습니다. (확인하려면 프로파일러를 사용하십시오):\n\
@@ -121,6 +123,17 @@ managerServlet.deleteFail=실패 - [{0}]을(를) 삭제할 수 없습니다. 이
managerServlet.deployFailed=실패 - 컨텍스트 경로 [{0}]에, 애플리케이션을 배치하지 못했습니다.
managerServlet.deployed=OK - 컨텍스트 경로 [{0}]에 애플리케이션을 배치했습니다.
managerServlet.deployedButNotStarted=실패 - 컨텍스트 경로 [{0}]에 있는 애플리케이션을 배치했으나,
컨텍스트가 시작되지 못했습니다.
+managerServlet.error.deploy=[{0}]을(를) 배치하는 중 오류 발생
+managerServlet.error.idleParam=정수 idle 파라미터 [{0}]을(를) 파싱할 수 없었습니다.
+managerServlet.error.reload=[{0}]을(를) 다시 로드하는 중 오류 발생
+managerServlet.error.resources=타입 [{0}]의 리소스들을 표시하는 중 오류 발생
+managerServlet.error.serverInfo=서버 정보를 표시하는 중 오류 발생
+managerServlet.error.sessions=컨텍스트 [{0}]을(를) 위한 세션들의 정보를 표시하는 중 오류 발생
+managerServlet.error.start=[{0}]을(를) 시작하는 중 오류 발생
+managerServlet.error.stop=[{0}]을(를) 중지시키는 중 오류 발생
+managerServlet.error.storeConfig=설정 저장 중 오류 발생
+managerServlet.error.storeContextConfig=컨텍스트 [{0}]을(를) 위한 설정을 저장하는 중 오류 발생
+managerServlet.error.undeploy=[{0}]을(를) 배치에서 제거하는 중 오류 발생
managerServlet.exception=실패 - 예외 발생 [{0}]
managerServlet.findleaksFail=실패 - 잠재 메모리 누수 찾기 실패: 호스트가 StandardHost의 인스턴스가
아닙니다.
managerServlet.findleaksList=OK - 다음 애플리케이션들에서 잠재적인 메모리 누수들이 발견되었습니다:
diff --git a/java/org/apache/catalina/manager/LocalStrings_zh_CN.properties
b/java/org/apache/catalina/manager/LocalStrings_zh_CN.properties
index 1d87180127..09137b6ce0 100644
--- a/java/org/apache/catalina/manager/LocalStrings_zh_CN.properties
+++ b/java/org/apache/catalina/manager/LocalStrings_zh_CN.properties
@@ -71,6 +71,8 @@
htmlManagerServlet.diagnosticsSslConnectorCipherText=列出每个配置好的TLS
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsButton=认证证书
htmlManagerServlet.diagnosticsSslConnectorTrustedCertsText=列出每个配置好的TLS虚拟主机和认证证书。
htmlManagerServlet.diagnosticsTitle=诊断
+htmlManagerServlet.error.sessions=错误的处理会话的命令,context [{0}]
+htmlManagerServlet.error.sortOrder=未知排序[{0}]
htmlManagerServlet.expire.explain=闲置 ≥
htmlManagerServlet.expire.unit=分钟
htmlManagerServlet.findleaksList=以下web应用程序已停止(重新加载、卸载),但是它们的类仍然加载在内存中,因此导致了内存泄漏(使用分析器确认):
@@ -120,6 +122,17 @@ managerServlet.deleteFail=失败 - 不能删除[{0}]。这个文件一直存在
managerServlet.deployFailed=FAIL - 在上下文路径[{0}]下部署应用失败
managerServlet.deployed=OK - 以应用path [{0}] 部署应用
managerServlet.deployedButNotStarted=失败 - 在上下文[{0}]下部署应用程序,但是上下文启动失败。
+managerServlet.error.deploy=部署[{0}]错误
+managerServlet.error.idleParam=无法解析闲置整数参数[{0}]
+managerServlet.error.reload=重新加载[{0}]错误
+managerServlet.error.resources=显示类型[{0}]的资源错误
+managerServlet.error.serverInfo=显示服务器信息错误
+managerServlet.error.sessions=显示上下文[{0}]的会话信息错误
+managerServlet.error.start=启动[{0}]失败
+managerServlet.error.stop=停止[{0}]错误
+managerServlet.error.storeConfig=保存配置错误
+managerServlet.error.storeContextConfig=上下文[{0}]存储配置错误
+managerServlet.error.undeploy=卸载[{0}]错误
managerServlet.exception=失败 - 发生异常[{0}]
managerServlet.findleaksFail=失败 - 查找泄漏失败:主机非StandardHost示例
managerServlet.findleaksList=OK - 在以下应用程序中发现潜在的内存泄漏
diff --git a/java/org/apache/catalina/manager/ManagerServlet.java
b/java/org/apache/catalina/manager/ManagerServlet.java
index 595c0db18f..51f3910d59 100644
--- a/java/org/apache/catalina/manager/ManagerServlet.java
+++ b/java/org/apache/catalina/manager/ManagerServlet.java
@@ -291,6 +291,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
if (command == null) {
command = request.getServletPath();
}
+
String config = request.getParameter("config");
String path = request.getParameter("path");
ContextName cn = null;
@@ -654,7 +655,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
mBeanServer.invoke(storeConfigOname, "storeConfig", null,
null);
writer.println(smClient.getString("managerServlet.saved"));
} catch (Exception e) {
- log("managerServlet.storeConfig", e);
+ log(sm.getString("managerServlet.error.storeConfig"), e);
writer.println(smClient.getString("managerServlet.exception",
e.toString()));
}
} else {
@@ -676,7 +677,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
writer.println(smClient.getString("managerServlet.savedContextFail", path));
}
} catch (Exception e) {
- log("managerServlet.save[" + path + "]", e);
+ log(sm.getString("managerServlet.error.storeContextConfig",
path), e);
writer.println(smClient.getString("managerServlet.exception",
e.toString()));
}
}
@@ -773,7 +774,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
writer.println(smClient.getString("managerServlet.inService",
displayPath));
}
} catch (Exception e) {
- log("managerServlet.check[" + displayPath + "]", e);
+ log(sm.getString("managerServlet.error.deploy", displayPath), e);
writer.println(smClient.getString("managerServlet.exception",
e.toString()));
return;
}
@@ -826,7 +827,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
writer.println(smClient.getString("managerServlet.inService",
displayPath));
}
} catch (Exception e) {
- log("managerServlet.check[" + displayPath + "]", e);
+ log(sm.getString("managerServlet.error.deploy", displayPath), e);
writer.println(smClient.getString("managerServlet.exception",
e.toString()));
return;
}
@@ -933,7 +934,7 @@ public class ManagerServlet extends HttpServlet implements
ContainerServlet {
writeDeployResult(writer, smClient, name, displayPath);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.install[" + displayPath + "]", t);
+ log(sm.getString("managerServlet.error.deploy", displayPath), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1020,7 +1021,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
writer.println(smClient.getString("managerServlet.reloaded",
cn.getDisplayName()));
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.reload[" + cn.getDisplayName() + "]", t);
+ log(sm.getString("managerServlet.error.reload",
cn.getDisplayName()), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1116,7 +1117,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.resources[" + type + "]", t);
+ log(sm.getString("managerServlet.error.resources", type), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
}
@@ -1138,7 +1139,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
System.getProperty("java.runtime.version"),
System.getProperty("java.vm.vendor")));
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- getServletContext().log("ManagerServlet.serverinfo", t);
+ log(sm.getString("managerServlet.error.serverInfo"), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
}
@@ -1238,7 +1239,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.sessions[" + displayPath + "]", t);
+ log(sm.getString("managerServlet.error.sessions", displayPath), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1260,7 +1261,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
try {
idle = Integer.parseInt(idleParam);
} catch (NumberFormatException e) {
- log("Could not parse idle parameter to an int: " + idleParam);
+ log(sm.getString("managerServlet.error.idleParam", idleParam));
}
}
sessions(writer, cn, idle, smClient);
@@ -1299,7 +1300,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
}
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- getServletContext().log(sm.getString("managerServlet.startFailed",
displayPath), t);
+ log(sm.getString("managerServlet.error.start", displayPath), t);
writer.println(smClient.getString("managerServlet.startFailed",
displayPath));
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1341,7 +1342,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
writer.println(smClient.getString("managerServlet.stopped",
displayPath));
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.stop[" + displayPath + "]", t);
+ log(sm.getString("managerServlet.error.stop", displayPath), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1416,7 +1417,7 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
writer.println(smClient.getString("managerServlet.undeployed",
displayPath));
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
- log("ManagerServlet.undeploy[" + displayPath + "]", t);
+ log(sm.getString("managerServlet.error.undeploy", displayPath), t);
writer.println(smClient.getString("managerServlet.exception",
t.toString()));
}
@@ -1590,7 +1591,6 @@ public class ManagerServlet extends HttpServlet
implements ContainerServlet {
}
throw e;
}
-
}
diff --git a/java/org/apache/catalina/manager/StatusManagerServlet.java
b/java/org/apache/catalina/manager/StatusManagerServlet.java
index 0bd9ce4e6e..bdb33b9733 100644
--- a/java/org/apache/catalina/manager/StatusManagerServlet.java
+++ b/java/org/apache/catalina/manager/StatusManagerServlet.java
@@ -16,12 +16,10 @@
*/
package org.apache.catalina.manager;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.UnknownHostException;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
@@ -89,7 +87,6 @@ public class StatusManagerServlet extends HttpServlet
implements NotificationLis
// --------------------------------------------------------- Public Methods
-
/**
* Initialize this servlet.
*/
@@ -298,9 +295,7 @@ public class StatusManagerServlet extends HttpServlet
implements NotificationLis
// use StatusTransformer to output status
StatusTransformer.writeVMState(writer, mode, args);
- Enumeration<ObjectName> enumeration = threadPools.elements();
- while (enumeration.hasMoreElements()) {
- ObjectName objectName = enumeration.nextElement();
+ for (ObjectName objectName : threadPools) {
String name = objectName.getKeyProperty("name");
args = new Object[19];
args[0] =
smClient.getString("htmlManagerServlet.connectorStateMaxThreads");
@@ -339,11 +334,10 @@ public class StatusManagerServlet extends HttpServlet
implements NotificationLis
// use StatusTransformer to output status
StatusTransformer.writeFooter(writer, mode);
-
}
- // ------------------------------------------- NotificationListener Methods
+ // ------------------------------------------- NotificationListener Methods
@Override
public void handleNotification(Notification notification, java.lang.Object
handback) {
diff --git a/java/org/apache/catalina/manager/StatusTransformer.java
b/java/org/apache/catalina/manager/StatusTransformer.java
index 9ba3c8b945..e67d1aa46b 100644
--- a/java/org/apache/catalina/manager/StatusTransformer.java
+++ b/java/org/apache/catalina/manager/StatusTransformer.java
@@ -23,7 +23,6 @@ import java.lang.management.MemoryUsage;
import java.lang.reflect.Method;
import java.text.MessageFormat;
import java.util.Date;
-import java.util.Enumeration;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedMap;
@@ -46,10 +45,8 @@ import org.apache.tomcat.util.security.Escape;
*/
public class StatusTransformer {
-
// --------------------------------------------------------- Public Methods
-
public static void setContentType(HttpServletResponse response, int mode) {
if (mode == 0) {
response.setContentType("text/html;charset=" + Constants.CHARSET);
@@ -321,10 +318,8 @@ public class StatusTransformer {
ObjectName grpName = null;
- Enumeration<ObjectName> enumeration =
globalRequestProcessors.elements();
- // Find the HTTP/1.1 RequestGroupInfo - BZ 65404
- while (enumeration.hasMoreElements()) {
- ObjectName objectName = enumeration.nextElement();
+ for (ObjectName objectName : globalRequestProcessors) {
+ // Find the HTTP/1.1 RequestGroupInfo - BZ 65404
if (name.equals(objectName.getKeyProperty("name")) &&
objectName.getKeyProperty("Upgrade") == null) {
grpName = objectName;
}
@@ -363,9 +358,7 @@ public class StatusTransformer {
"</th><th>" + args[13] + "</th><th>" + args[14] +
"</th><th>" + args[15] + "</th><th>" + args[16] +
"</th><th>" + args[17] + "</th></tr>");
- enumeration = requestProcessors.elements();
- while (enumeration.hasMoreElements()) {
- ObjectName objectName = enumeration.nextElement();
+ for (ObjectName objectName : requestProcessors) {
if (name.equals(objectName.getKeyProperty("worker"))) {
writer.print("<tr>");
writeProcessorState(writer, objectName, mBeanServer, mode);
@@ -389,10 +382,8 @@ public class StatusTransformer {
ObjectName grpName = null;
- Enumeration<ObjectName> enumeration =
globalRequestProcessors.elements();
- // Find the HTTP/1.1 RequestGroupInfo - BZ 65404
- while (enumeration.hasMoreElements()) {
- ObjectName objectName = enumeration.nextElement();
+ for (ObjectName objectName : globalRequestProcessors) {
+ // Find the HTTP/1.1 RequestGroupInfo - BZ 65404
if (name.equals(objectName.getKeyProperty("name")) &&
objectName.getKeyProperty("Upgrade") == null) {
grpName = objectName;
}
@@ -410,9 +401,7 @@ public class StatusTransformer {
writer.write(" />");
writer.write("<workers>");
- enumeration = requestProcessors.elements();
- while (enumeration.hasMoreElements()) {
- ObjectName objectName = enumeration.nextElement();
+ for (ObjectName objectName : requestProcessors) {
if (name.equals(objectName.getKeyProperty("worker"))) {
writeProcessorState(writer, objectName, mBeanServer,
mode);
}
@@ -422,7 +411,6 @@ public class StatusTransformer {
writer.write("</connector>");
}
-
}
@@ -633,7 +621,7 @@ public class StatusTransformer {
}
writer.print("<a href=\"#" + count++ + ".0\">");
- writer.print(Escape.htmlElementContext(webModuleName));
+ writer.print(Escape.htmlElementContent(webModuleName));
writer.print("</a>");
if (iterator.hasNext()) {
writer.print("<br>");
@@ -709,7 +697,7 @@ public class StatusTransformer {
}
writer.print("<h1>");
- writer.print(Escape.htmlElementContext(name));
+ writer.print(Escape.htmlElementContent(name));
writer.print("</h1>");
writer.print("</a>");
@@ -834,11 +822,11 @@ public class StatusTransformer {
String[] mappings = (String[]) mBeanServer.invoke(objectName,
"findMappings", null, null);
writer.print("<h2>");
- writer.print(Escape.htmlElementContext(servletName));
+ writer.print(Escape.htmlElementContent(servletName));
if (mappings != null && mappings.length > 0) {
writer.print(" [ ");
for (int i = 0; i < mappings.length; i++) {
- writer.print(Escape.htmlElementContext(mappings[i]));
+ writer.print(Escape.htmlElementContent(mappings[i]));
if (i < mappings.length - 1) {
writer.print(" , ");
}
diff --git a/java/org/apache/catalina/manager/util/SessionUtils.java
b/java/org/apache/catalina/manager/util/SessionUtils.java
index b4280f598d..5016b29dec 100644
--- a/java/org/apache/catalina/manager/util/SessionUtils.java
+++ b/java/org/apache/catalina/manager/util/SessionUtils.java
@@ -109,7 +109,7 @@ public class SessionUtils {
final List<Object> tapestryArray = new ArrayList<>();
for (Enumeration<String> enumeration =
in_session.getAttributeNames(); enumeration.hasMoreElements();) {
String name = enumeration.nextElement();
- if (name.indexOf("tapestry") > -1 && name.indexOf("engine") >
-1 && null != in_session.getAttribute(name)) {//$NON-NLS-1$ //$NON-NLS-2$
+ if (name.contains("tapestry") && name.contains("engine") &&
null != in_session.getAttribute(name)) {//$NON-NLS-1$ //$NON-NLS-2$
tapestryArray.add(in_session.getAttribute(name));
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]