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

Method deployWARs

java/org/apache/catalina/startup/HostConfig.java:708–772  ·  view source on GitHub ↗

Deploy WAR files. @param appBase The base path for applications @param files The WARs to deploy

(File appBase, String[] files)

Source from the content-addressed store, hash-verified

706 * @param files The WARs to deploy
707 */
708 protected void deployWARs(File appBase, String[] files) {
709
710 if (files == null) {
711 return;
712 }
713
714 ExecutorService es = host.getStartStopExecutor();
715 List<Future<?>> results = new ArrayList<>();
716
717 for (String file : files) {
718 if (file.equalsIgnoreCase("META-INF")) {
719 continue;
720 }
721 if (file.equalsIgnoreCase("WEB-INF")) {
722 continue;
723 }
724
725 File war = new File(appBase, file);
726 if (file.toLowerCase(Locale.ENGLISH).endsWith(".war") && war.isFile() && !invalidWars.contains(file)) {
727 ContextName cn = new ContextName(file, true);
728 if (tryAddServiced(cn.getName())) {
729 try {
730 if (deploymentExists(cn.getName())) {
731 DeployedApplication app = deployed.get(cn.getName());
732 boolean unpackWAR = unpackWARs;
733 if (unpackWAR && host.findChild(cn.getName()) instanceof StandardContext) {
734 unpackWAR = ((StandardContext) host.findChild(cn.getName())).getUnpackWAR();
735 }
736 if (!unpackWAR && app != null) {
737 // Need to check for a directory that should not be
738 // there
739 File dir = new File(appBase, cn.getBaseName());
740 if (dir.exists()) {
741 if (!app.loggedDirWarning) {
742 log.warn(sm.getString("hostConfig.deployWar.hiddenDir", dir.getAbsoluteFile(),
743 war.getAbsoluteFile()));
744 app.loggedDirWarning = true;
745 }
746 } else {
747 app.loggedDirWarning = false;
748 }
749 }
750 removeServiced(cn.getName());
751 continue;
752 }
753
754 // DeployWAR will call removeServiced
755 results.add(es.submit(new DeployWar(this, cn, war)));
756 } catch (Throwable t) {
757 ExceptionUtils.handleThrowable(t);
758 removeServiced(cn.getName());
759 throw t;
760 }
761 }
762 }
763 }
764
765 for (Future<?> result : results) {

Callers 1

deployAppsMethod · 0.95

Calls 15

tryAddServicedMethod · 0.95
getNameMethod · 0.95
deploymentExistsMethod · 0.95
getBaseNameMethod · 0.95
removeServicedMethod · 0.95
handleThrowableMethod · 0.95
endsWithMethod · 0.80
getUnpackWARMethod · 0.80
getStartStopExecutorMethod · 0.65
isFileMethod · 0.65
containsMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected