use of org.apache.tomcat.JarScanner in project tomcat by apache.
the class ContextConfig method processJarsForWebFragments.
/**
* Scan /WEB-INF/lib for JARs and for each one found add it and any
* /META-INF/web-fragment.xml to the resulting Map. web-fragment.xml files
* will be parsed before being added to the map. Every JAR will be added and
* <code>null</code> will be used if no web-fragment.xml was found. Any JARs
* known not contain fragments will be skipped.
*
* @param application The main web.xml metadata
* @param webXmlParser The parser to use to process the web.xml file
* @return A map of JAR name to processed web fragment (if any)
*/
protected Map<String, WebXml> processJarsForWebFragments(WebXml application, WebXmlParser webXmlParser) {
JarScanner jarScanner = context.getJarScanner();
boolean delegate = false;
if (context instanceof StandardContext) {
delegate = ((StandardContext) context).getDelegate();
}
boolean parseRequired = true;
Set<String> absoluteOrder = application.getAbsoluteOrdering();
if (absoluteOrder != null && absoluteOrder.isEmpty() && !context.getXmlValidation()) {
// Skip parsing when there is an empty absolute ordering and
// validation is not enabled
parseRequired = false;
}
FragmentJarScannerCallback callback = new FragmentJarScannerCallback(webXmlParser, delegate, parseRequired);
jarScanner.scan(JarScanType.PLUGGABILITY, context.getServletContext(), callback);
if (!callback.isOk()) {
ok = false;
}
return callback.getFragments();
}
Aggregations