MCPcopy Create free account
hub / github.com/apache/tomcat / undeploy

Method undeploy

java/org/apache/catalina/manager/ManagerServlet.java:1420–1483  ·  view source on GitHub ↗

Undeploy the web application at the specified context path. @param writer Writer to render to @param cn Name of the application to be removed @param smClient i18n support for current client's locale

(PrintWriter writer, ContextName cn, StringManager smClient)

Source from the content-addressed store, hash-verified

1418 * @param smClient i18n support for current client's locale
1419 */
1420 protected void undeploy(PrintWriter writer, ContextName cn, StringManager smClient) {
1421
1422 if (debug >= 1) {
1423 log("undeploy: Undeploying web application at '" + cn + "'");
1424 }
1425
1426 if (!validateContextName(cn, writer, smClient)) {
1427 return;
1428 }
1429
1430 String name = cn.getName();
1431 String baseName = cn.getBaseName();
1432 String displayPath = cn.getDisplayName();
1433
1434 try {
1435 // Validates the Context of the specified application
1436 Context context = getContextForName(cn, writer, smClient);
1437 if (context == null) {
1438 return;
1439 }
1440
1441 if (!isDeployed(name)) {
1442 writer.println(
1443 smClient.getString("managerServlet.notDeployed", Escape.htmlElementContent(displayPath)));
1444 return;
1445 }
1446
1447 if (tryAddServiced(name)) {
1448 try {
1449 // Try to stop the context first to be nicer
1450 context.stop();
1451 } catch (Throwable t) {
1452 ExceptionUtils.handleThrowable(t);
1453 }
1454 try {
1455 File war = new File(host.getAppBaseFile(), baseName + ".war");
1456 File dir = new File(host.getAppBaseFile(), baseName);
1457 File xml = new File(configBase, baseName + ".xml");
1458 if (war.exists() && !war.delete()) {
1459 writer.println(smClient.getString("managerServlet.deleteFail", war));
1460 return;
1461 } else if (dir.exists() && !ExpandWar.delete(dir, false)) {
1462 writer.println(smClient.getString("managerServlet.deleteFail", dir));
1463 return;
1464 } else if (xml.exists() && !xml.delete()) {
1465 writer.println(smClient.getString("managerServlet.deleteFail", xml));
1466 return;
1467 }
1468 } finally {
1469 removeServiced(name);
1470 }
1471 // Perform new deployment
1472 check(name);
1473 } else {
1474 writer.println(smClient.getString("managerServlet.inService", displayPath));
1475 }
1476 writer.println(smClient.getString("managerServlet.undeployed", displayPath));
1477 } catch (Throwable t) {

Callers 1

doGetMethod · 0.95

Calls 15

validateContextNameMethod · 0.95
getContextForNameMethod · 0.95
isDeployedMethod · 0.95
htmlElementContentMethod · 0.95
tryAddServicedMethod · 0.95
handleThrowableMethod · 0.95
deleteMethod · 0.95
removeServicedMethod · 0.95
checkMethod · 0.95
logMethod · 0.65
getNameMethod · 0.65
getBaseNameMethod · 0.65

Tested by

no test coverage detected