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 {
FileDirContext r = new FileDirContext();
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 = null;
boolean hasWSLDD = (new File(base, WEBLOGIC_XML)).exists();
if (!gfDDOverWLSDD && !ignoreWLSDD && hasWSLDD) {
webXmlParser = new WeblogicXmlParser(base.getAbsolutePath());
} else if ((new File(base, GLASSFISH_WEB_XML)).exists()) {
webXmlParser = new GlassFishWebXmlParser(base.getAbsolutePath());
} else if ((new File(base, SUN_WEB_XML)).exists()) {
webXmlParser = new SunWebXmlParser(base.getAbsolutePath());
} else if (gfDDOverWLSDD && !ignoreWLSDD && hasWSLDD) {
webXmlParser = new WeblogicXmlParser(base.getAbsolutePath());
} else { // default
if (gfDDOverWLSDD || ignoreWLSDD) {
webXmlParser = new GlassFishWebXmlParser(base.getAbsolutePath());
} else {
webXmlParser = new WeblogicXmlParser(base.getAbsolutePath());
}
}
configureLoaderAttributes(cloader, webXmlParser, base);
configureLoaderProperties(cloader, webXmlParser, base);
configureContextXmlAttribute(cloader, base, context);
} catch(MalformedURLException malex) {
logger.log(Level.SEVERE, malex.getMessage());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, malex.getMessage(), malex);
}
} catch(XMLStreamException xse) {
logger.log(Level.SEVERE, xse.getMessage());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, xse.getMessage(), xse);
}
} catch(FileNotFoundException fnfe) {
logger.log(Level.SEVERE, fnfe.getMessage());
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, fnfe.getMessage(), fnfe);
}
}
cloader.start();
return cloader;
}