Path archivePath = null;
if (contextUrl == null)
contextUrl = webUri;
WebAppController controller = null;
if (webUri.endsWith(".war")) {
// server/2a16
String name = webUri.substring(0, webUri.length() - 4);
int p = name.lastIndexOf('/');
if (p > 0)
name = name.substring(p + 1);
// XXX:
if (contextUrl.equals(""))
contextUrl = "/" + name;
if (contextUrl.endsWith(".war"))
contextUrl = contextUrl.substring(0, contextUrl.length() - 4);
Path expandPath = _webappsPath;
try {
expandPath.mkdirs();
} catch (Exception e) {
log.log(Level.WARNING, e.toString(), e);
}
archivePath = path;
path = expandPath.lookup(name);
} else {
// server/2a15
if (contextUrl.equals("")) {
String name = webUri;
int p = name.lastIndexOf('/');
if (p > 0)
name = name.substring(p + 1);
contextUrl = "/" + name;
}
// server/2a17
if (contextUrl.endsWith(".war"))
contextUrl = contextUrl.substring(0, contextUrl.length() - 4);
}
if (! contextUrl.startsWith("/"))
contextUrl = "/" + contextUrl;
controller = findWebAppEntry(contextUrl);
if (controller == null) {
controller = new WebAppController(contextUrl,
contextUrl,
path,
_container);
_webApps.add(controller);
}
if (archivePath != null)
controller.setArchivePath(archivePath);
controller.setDynamicDeploy(true);
if (_configException != null)
controller.setConfigException(_configException);
for (WebAppConfig config : web.getWebAppList())
controller.addConfigDefault(config);
}