// Prepare our output writer to generate the response message
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.
response.setHeader("X-Content-Type-Options", "nosniff");
PrintWriter writer = response.getWriter();
// Identify the request parameters that we need
String command = request.getPathInfo(); if (command == null) {
command = request.getServletPath();
}
String path = request.getParameter("path");
ContextName cn = null; if (path != null) {
cn = new ContextName(path, request.getParameter("version"));
}
String config = request.getParameter("config");
String tag = request.getParameter("tag"); boolean update = false; if (request.getParameter("update") != null && request.getParameter("update").equals("true")) {
update = true;
}
// Prepare our output writer to generate the response message
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.
response.setHeader("X-Content-Type-Options", "nosniff");
PrintWriter writer = response.getWriter();
// Process the requested command if (command == null) {
writer.println(smClient.getString("managerServlet.noCommand"));
} elseif (command.equals("/deploy")) {
deploy(writer, config, cn, tag, update, request, smClient);
} else {
writer.println(smClient.getString("managerServlet.unknownCommand", command));
}
// Finish up the response
writer.flush();
writer.close();
// Ensure that our ContainerServlet properties have been set if (wrapper == null || context == null) { thrownew UnavailableException(sm.getString("managerServlet.noWrapper"));
}
// Set our properties from the initialization parameters
String value = null; try {
value = getServletConfig().getInitParameter("debug");
debug = Integer.parseInt(value);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
}
// Acquire global JNDI resources if available
Server server = ((Engine) host.getParent()).getService().getServer(); if (server != null) {
global = server.getGlobalNamingContext();
}
// Calculate the directory into which we will be deploying applications
versioned = (File) getServletContext().getAttribute(ServletContext.TEMPDIR);
configBase = new File(context.getCatalinaBase(), "conf");
Container container = context;
Container host = null;
Container engine = null; while (container != null) { if (container instanceof Host) {
host = container;
} if (container instanceof Engine) {
engine = container;
}
container = container.getParent();
} if (engine != null) {
configBase = new File(configBase, engine.getName());
} if (host != null) {
configBase = new File(configBase, host.getName());
} // Note: The directory must exist for this to work.
// Log debugging messages as necessary if (debug >= 1) {
log("init: Associated with Deployer '" + oname + "'"); if (global != null) {
log("init: Global resources are available");
}
}
ObjectName storeConfigOname; try { // Note: Hard-coded domain used since this object is per Server/JVM
storeConfigOname = new ObjectName("Catalina:type=StoreConfig");
} catch (MalformedObjectNameException e) { // Should never happen. The name above is valid.
log(sm.getString("managerServlet.exception"), e);
writer.println(smClient.getString("managerServlet.exception", e.toString())); return;
}
if (!mBeanServer.isRegistered(storeConfigOname)) {
writer.println(smClient.getString("managerServlet.storeConfig.noMBean", storeConfigOname)); return;
}
if (debug >= 1) { if (config == null) {
log("deploy: Deploying web application '" + cn + "'");
} else {
log("deploy: Deploying web application '" + cn + "' " + "with context configuration at '" + config + "'");
}
}
// Validate the requested context path if (!validateContextName(cn, writer, smClient)) { return;
}
String name = cn.getName();
String baseName = cn.getBaseName();
String displayPath = cn.getDisplayName();
// If app exists deployment can only proceed if update is true // Note existing WAR will be deleted and then replaced
Context context = (Context) host.findChild(name); if (context != null && !update) {
writer.println(smClient.getString("managerServlet.alreadyContext", displayPath)); return;
}
File deployedWar = new File(host.getAppBaseFile(), baseName + ".war");
// Determine full path for uploaded WAR
File uploadedWar; if (tag == null) { if (update) { // Append ".tmp" to the file name so it won't get deployed if auto // deployment is enabled. It also means the old war won't get // deleted if the upload fails
uploadedWar = new File(deployedWar.getAbsolutePath() + ".tmp"); if (uploadedWar.exists() && !uploadedWar.delete()) {
writer.println(smClient.getString("managerServlet.deleteFail", uploadedWar));
}
} else {
uploadedWar = deployedWar;
}
} else {
File uploadPath = new File(versioned, tag); if (!uploadPath.mkdirs() && !uploadPath.isDirectory()) {
writer.println(smClient.getString("managerServlet.mkdirFail", uploadPath)); return;
}
uploadedWar = new File(uploadPath, baseName + ".war");
} if (debug >= 2) {
log("Uploading WAR file to " + uploadedWar);
}
try { if (tryAddServiced(name)) { try { if (config != null) { if (!configBase.mkdirs() && !configBase.isDirectory()) {
writer.println(smClient.getString("managerServlet.mkdirFail", configBase)); return;
} if (ExpandWar.copy(new File(config), new File(configBase, baseName + ".xml")) == false) { thrownew Exception(sm.getString("managerServlet.copyError", config));
}
} // Upload WAR
uploadWar(writer, request, uploadedWar, smClient); if (update && tag == null) { if (deployedWar.exists() && !deployedWar.delete()) {
writer.println(smClient.getString("managerServlet.deleteFail", deployedWar)); return;
} // Rename uploaded WAR file if (!uploadedWar.renameTo(deployedWar)) {
writer.println(smClient.getString("managerServlet.renameFail", uploadedWar, deployedWar)); return;
}
} if (tag != null) { // Copy WAR to the host's appBase
ExpandWar.copy(uploadedWar, deployedWar);
}
} finally {
removeServiced(name);
} // Perform new deployment
check(name);
} else {
writer.println(smClient.getString("managerServlet.inService", displayPath));
}
} catch (Exception e) {
log(sm.getString("managerServlet.error.deploy", displayPath), e);
writer.println(smClient.getString("managerServlet.exception", e.toString())); return;
}
if (config != null && config.length() == 0) {
config = null;
} if (war != null && war.length() == 0) {
war = null;
}
if (debug >= 1) { if (config != null) { if (war != null) {
log("install: Installing context configuration at '" + config + "' from '" + war + "'");
} else {
log("install: Installing context configuration at '" + config + "'");
}
} else { if (cn != null) {
log("install: Installing web application '" + cn + "' from '" + war + "'");
} else {
log("install: Installing web application from '" + war + "'");
}
}
}
if (!validateContextName(cn, writer, smClient)) { return;
}
@SuppressWarnings("null") // checked in call above
String name = cn.getName();
String baseName = cn.getBaseName();
String displayPath = cn.getDisplayName();
// If app exists deployment can only proceed if update is true // Note existing files will be deleted and then replaced
Context context = (Context) host.findChild(name); if (context != null && !update) {
writer.println(smClient.getString("managerServlet.alreadyContext", displayPath)); return;
}
if (config != null && config.startsWith("file:")) {
config = config.substring("file:".length());
} if (war != null && war.startsWith("file:")) {
war = war.substring("file:".length());
}
try { if (tryAddServiced(name)) { try { if (config != null) { if (!configBase.mkdirs() && !configBase.isDirectory()) {
writer.println(smClient.getString("managerServlet.mkdirFail", configBase)); return;
}
File localConfigFile = new File(configBase, baseName + ".xml");
File configFile = new File(config); // Skip delete and copy if source == destination if (!configFile.getCanonicalPath().equals(localConfigFile.getCanonicalPath())) { if (localConfigFile.isFile() && !localConfigFile.delete()) {
writer.println(smClient.getString("managerServlet.deleteFail", localConfigFile)); return;
}
ExpandWar.copy(configFile, localConfigFile);
}
} if (war != null) {
File localWarFile; if (war.endsWith(".war")) {
localWarFile = new File(host.getAppBaseFile(), baseName + ".war");
} else {
localWarFile = new File(host.getAppBaseFile(), baseName);
}
File warFile = new File(war); // Skip delete and copy if source == destination if (!warFile.getCanonicalPath().equals(localWarFile.getCanonicalPath())) { if (localWarFile.exists() && !ExpandWar.delete(localWarFile)) {
writer.println(smClient.getString("managerServlet.deleteFail", localWarFile)); return;
}
ExpandWar.copy(warFile, localWarFile);
}
}
} finally {
removeServiced(name);
} // Perform new deployment
check(name);
} else {
writer.println(smClient.getString("managerServlet.inService", displayPath));
}
writeDeployResult(writer, smClient, name, displayPath);
} catch (Throwable t) {
ExceptionUtils.handleThrowable(t);
log(sm.getString("managerServlet.error.deploy", displayPath), t);
writer.println(smClient.getString("managerServlet.exception", t.toString()));
}
if (debug >= 1) { if (type != null) {
log("resources: Listing resources of type " + type);
} else {
log("resources: Listing resources of all types");
}
}
// Is the global JNDI resources context available? if (global == null) {
writer.println(smClient.getString("managerServlet.noGlobal")); return;
}
// Enumerate the global JNDI resources of the requested type if (type != null) {
writer.println(smClient.getString("managerServlet.resourcesType", type));
} else {
writer.println(smClient.getString("managerServlet.resourcesAll"));
}
// ContextName should be non-null with a path that is empty or starts // with / if (cn != null && (cn.getPath().startsWith("/") || cn.getPath().equals(""))) { returntrue;
}
protected Map<String,List<String>> getConnectorCiphers(StringManager smClient) {
Map<String,List<String>> result = new HashMap<>();
Connector connectors[] = getConnectors(); for (Connector connector : connectors) { if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) {
SSLHostConfig[] sslHostConfigs = connector.getProtocolHandler().findSslHostConfigs(); for (SSLHostConfig sslHostConfig : sslHostConfigs) {
String name = connector.toString() + "-" + sslHostConfig.getHostName(); /* Add cipher list, keep order but remove duplicates */
result.put(name, new ArrayList<>(new LinkedHashSet<>(Arrays.asList(sslHostConfig.getEnabledCiphers()))));
}
} else {
ArrayList<String> cipherList = new ArrayList<>(1);
cipherList.add(smClient.getString("managerServlet.notSslConnector"));
result.put(connector.toString(), cipherList);
}
} return result;
}
protected Map<String,List<String>> getConnectorCerts(StringManager smClient) {
Map<String,List<String>> result = new HashMap<>();
Connector connectors[] = getConnectors(); for (Connector connector : connectors) { if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) {
SSLHostConfig[] sslHostConfigs = connector.getProtocolHandler().findSslHostConfigs(); for (SSLHostConfig sslHostConfig : sslHostConfigs) { if (sslHostConfig.getOpenSslContext().longValue() == 0) { // Not set. Must be JSSE based.
Set<SSLHostConfigCertificate> sslHostConfigCerts = sslHostConfig.getCertificates(); for (SSLHostConfigCertificate sslHostConfigCert : sslHostConfigCerts) {
String name = connector.toString() + "-" + sslHostConfig.getHostName() + "-" +
sslHostConfigCert.getType();
List<String> certList = new ArrayList<>();
SSLContext sslContext = sslHostConfigCert.getSslContext();
String alias = sslHostConfigCert.getCertificateKeyAlias(); if (alias == null) {
alias = SSLUtilBase.DEFAULT_KEY_ALIAS;
}
X509Certificate[] certs = sslContext.getCertificateChain(alias); if (certs == null) {
certList.add(smClient.getString("managerServlet.certsNotAvailable"));
} else { for (Certificate cert : certs) {
certList.add(cert.toString());
}
}
result.put(name, certList);
}
} else {
List<String> certList = new ArrayList<>();
certList.add(smClient.getString("managerServlet.certsNotAvailable"));
String name = connector.toString() + "-" + sslHostConfig.getHostName();
result.put(name, certList);
}
}
} else {
List<String> certList = new ArrayList<>(1);
certList.add(smClient.getString("managerServlet.notSslConnector"));
result.put(connector.toString(), certList);
}
}
return result;
}
protected Map<String,List<String>> getConnectorTrustedCerts(StringManager smClient) {
Map<String,List<String>> result = new HashMap<>();
Connector connectors[] = getConnectors(); for (Connector connector : connectors) { if (Boolean.TRUE.equals(connector.getProperty("SSLEnabled"))) {
SSLHostConfig[] sslHostConfigs = connector.getProtocolHandler().findSslHostConfigs(); for (SSLHostConfig sslHostConfig : sslHostConfigs) {
String name = connector.toString() + "-" + sslHostConfig.getHostName();
List<String> certList = new ArrayList<>(); if (sslHostConfig.getOpenSslContext().longValue() == 0) { // Not set. Must be JSSE based.
SSLContext sslContext = sslHostConfig.getCertificates().iterator().next().getSslContext();
X509Certificate[] certs = sslContext.getAcceptedIssuers(); if (certs == null) {
certList.add(smClient.getString("managerServlet.certsNotAvailable"));
} elseif (certs.length == 0) {
certList.add(smClient.getString("managerServlet.trustedCertsNotConfigured"));
} else { for (Certificate cert : certs) {
certList.add(cert.toString());
}
}
} else {
certList.add(smClient.getString("managerServlet.certsNotAvailable"));
}
result.put(name, certList);
}
} else {
List<String> certList = new ArrayList<>(1);
certList.add(smClient.getString("managerServlet.notSslConnector"));
result.put(connector.toString(), certList);
}
}
return result;
}
private Connector[] getConnectors() {
Engine e = (Engine) host.getParent();
Service s = e.getService(); return s.findConnectors();
}
}
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.45Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-06-10)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.