WebApplicationServerDescriptor wsd = WebApplicationServerDescriptor.get(depl.getDeploymentStructure());
String path = wsd == null ? artifact.getName().split(".war")[0] : wsd.getContextPath();
if (!path.startsWith("/")) path = "/" + path;
WebApplicationStandard application = new WebApplicationStandard(artifact.getName(), path, depl.getDeploymentStructure());
application.setReloadable( !depl.getDeploymentStructure().isReadOnly() );
if (wsd != null) application.addAuxilaryDescriptor(wsd);
application.addAuxilaryDescriptor(artifact);
application.addAuxilaryDescriptor(depl.getDeploymentStructure());
IWebServerHost host = wsd != null && wsd.getHost() != null ? server.getHost(wsd.getHost()) : server.getDefaultHost();
if (host == null) throw new VirtualArtifactDeployerException(this, artifact, "No host could be found for deployment");
if (wsd != null) {
for (WebApplicationExtensionDescriptor waed : wsd.getExtensions()) {
String ecl = waed.getClassName() == null ? server.getExtension(waed.getName()) : waed.getClassName();
if (ecl == null) continue;
application.addExtension(waed.getName(), ecl, waed.getSettings());
}
}
depl.set("host", host);
depl.setApplication(application);