/**
* Process additional descriptors: TLDs, web fragments, and map overlays.
*/
protected void applicationExtraDescriptorsConfig() {
JarRepository jarRepository = context.getJarRepository();
HashSet<String> warTLDs = new HashSet<String>();
// Find any TLD file in /WEB-INF
DirContext resources = context.getResources();
if (resources != null) {
tldScanResourcePathsWebInf(resources, "/WEB-INF", warTLDs);
}
TLDs.put("", warTLDs);
File[] explodedJars = jarRepository.findExplodedJars();
for (int i = 0; i < explodedJars.length; i++) {
scanClasses(explodedJars[i], "", !context.getIgnoreAnnotations());
}
// Parse web fragment according to order
Iterator<String> orderIterator = order.iterator();
while (orderIterator.hasNext()) {
String jar = orderIterator.next();
JarFile jarFile = jarRepository.findJar(jar);
InputStream is = null;
ZipEntry entry = jarFile.getEntry(Globals.WEB_FRAGMENT_PATH);
if (entry != null) {
try {
is = jarFile.getInputStream(entry);
InputSource input = new InputSource((new File(jar)).toURI().toURL().toExternalForm());
input.setByteStream(is);
synchronized (webFragmentDigester) {
try {
webFragmentDigester.push(context);
webFragmentDigester.setErrorHandler(new ContextErrorHandler());
webFragmentDigester.parse(input);
if (parseException != null) {
ok = false;
}
} finally {
webFragmentDigester.reset();
webFragmentRuleSet.recycle();
parseException = null;
}
}
} catch (Exception e) {
log.error(sm.getString("contextConfig.applicationParse", jar), e);
ok = false;
} finally {
try {
if (is != null) {
is.close();
}
} catch (IOException e) {
// Ignore
}
}
}
// Scan the JAR for TLDs and annotations
scanJar(jarFile, true);
}
// Process any Jar not in the order
JarFile[] jarFiles = jarRepository.findJars();
for (int i = 0; i < jarFiles.length; i++) {
if (!order.contains(jarFiles[i].getName())) {
// Scan the JAR for TLDs only
scanJar(jarFiles[i], false);
}