// invoke setters
// for the URL of the war file
try {
webAppContext.setWar(war.getArchive().getURL().getPath());
} catch (ArchiveException e) {
throw new DeployerException("Cannot get URL from the archive '" + war.getArchive() + "'.", e);
}
// Defines the name of the context
webAppContext.setContextPath("/" + war.getContextRoot());
// Java delegation model = true
webAppContext.setParentLoaderPriority(true);
// add the built context on the existing list
this.contextHandlerCollection.addHandler(webAppContext);
// set the thread context classloader to the parent classloader
ClassLoader oldCl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(parentClassLoader);
// start context
try {
webAppContext.start();
} catch (Exception e) {
throw new DeployerException("Cannot start the context '" + war.getContextRoot() + "'", e);
} finally {
// reset classloader
Thread.currentThread().setContextClassLoader(oldCl);
}