return detector.handles(archive);
}
@Override
public ClassLoader getClassLoader(final ClassLoader parent, DeploymentContext context) {
WebappClassLoader cloader = AccessController.doPrivileged(new PrivilegedAction<WebappClassLoader>() {
@Override
public WebappClassLoader run() {
return new WebappClassLoader(parent);
}
});
try {
WebDirContext r = new WebDirContext();
File base = new File(context.getSource().getURI());
r.setDocBase(base.getAbsolutePath());
cloader.setResources(r);
cloader.addRepository("WEB-INF/classes/", new File(base, "WEB-INF/classes/"));
if (context.getScratchDir("ejb") != null) {
cloader.addRepository(context.getScratchDir("ejb").toURI().toURL().toString().concat("/"));
}
if (context.getScratchDir("jsp") != null) {
cloader.setWorkDir(context.getScratchDir("jsp"));
}
// add libraries referenced from manifest
for (URL url : getManifestLibraries(context)) {
cloader.addRepository(url.toString());
}
WebXmlParser webXmlParser = getWebXmlParser(context.getSource());
configureLoaderAttributes(cloader, webXmlParser, base);
configureLoaderProperties(cloader, webXmlParser, base);
configureContextXmlAttribute(cloader, base, context);
try {
final DeploymentContext dc = context;
final ClassLoader cl = cloader;
AccessController.doPrivileged(
new PermsArchiveDelegate.SetPermissionsAction(
SMGlobalPolicyUtil.CommponentType.war, dc, cl));
} catch (PrivilegedActionException e) {
throw (SecurityException)e.getException();
}
} catch(XMLStreamException xse) {
logger.log(Level.SEVERE, xse.getMessage());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, xse.getMessage(), xse);
}
xse.printStackTrace();
} catch(IOException ioe) {
logger.log(Level.SEVERE, ioe.getMessage());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, ioe.getMessage(), ioe);
}
ioe.printStackTrace();
}
cloader.start();
return cloader;
}