*/
public synchronized WebApplication start(DeploymentUnit unit, JBossWebMetaData metaData) throws Exception
{
Thread thread = Thread.currentThread();
ClassLoader appClassLoader = thread.getContextClassLoader();
WebApplication webApp = null;
try
{
// Create a classloader for the war to ensure a unique ENC
ClassLoader warLoader = unit.getClassLoader();
thread.setContextClassLoader(warLoader);
String webContext = metaData.getContextRoot();
// Get the war URL
URL warUrl = unit.getAttachment("org.jboss.web.expandedWarURL", URL.class);
if (warUrl == null && unit instanceof VFSDeploymentUnit)
{
VFSDeploymentUnit vdu = VFSDeploymentUnit.class.cast(unit);
warUrl = VFSUtils.getPhysicalURL(vdu.getRoot());
}
// Dynamic WebMetaData deployments might not provide an URL
// We use the DEploymentUnit name as identifier instead.
// The JAXWS Endpoint API for example does this.
String warURLString = (warUrl != null ? warUrl.toExternalForm() : unit.getName());
// Strip any jar: url syntax. This should be be handled by the vfs
if (warURLString.startsWith("jar:"))
warURLString = warURLString.substring(4, warURLString.length() - 2);
log.debug("webContext: " + webContext);
log.debug("warURL: " + warURLString);
// Register the permissions with the JACC layer
String contextID = metaData.getJaccContextID();
if (contextID == null)
contextID = unit.getSimpleName();
metaData.setJaccContextID(contextID);
webApp = new WebApplication(metaData);
webApp.setClassLoader(warLoader);
webApp.setDeploymentUnit(unit);
performDeploy(webApp, warURLString);
}
finally
{
thread.setContextClassLoader(appClassLoader);