Bug 55811

Summary: Do not parse web-fragment.xml files when empty absolute-ordering
Product: Tomcat 7 Reporter: Konstantin Kolinko <knst.kolinko>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: enhancement    
Priority: P2    
Version: 7.0.47   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Konstantin Kolinko 2013-11-22 14:45:40 UTC
ContextConfig.webConfig() does the following:

1. Scans for web fragments
> Map<String,WebXml> fragments = processJarsForWebFragments();

This method
a) returns a list of all JAR files, not ignored by jarsToSkip options
b) parses "META-INF/web-fragment.xml" files when they are present

2. Filters and sorts them according to ordering
> orderedFragments = WebXml.orderWebFragments(webXml, fragments, sContext);

3. Uses the ordered set of fragments to look for SCI declarations
> processServletContainerInitializers(orderedFragments);

4. Uses the ordered set of fragments to
- scan them for annotated classes
- merge into main web.xml

5. Uses the original list of web fragments to scan for resources.
> processResourceJARs(resourceJars);

I am saying that parsing of the fragments (step 1-b)) can be skipped when the web application is configured with an empty ordered-fragments element and web.xml validation is turned off (strict servlet compliance is off).

Note that metadata-complete=true alone does not allow to skip that parsing, because we need fragment names to perform the ordering.

It seems that skipping that parsing when validation is on would be a bad idea. We are still using those JARs for resources and thus I think we should validate them.
Comment 1 Mark Thomas 2013-12-07 21:05:07 UTC
Fixed in 8.0.x and 7.0.x for 8.0.0-RC6 and 7.0.48 respectively.