Bug 49714

Summary: The annotation process of Jar should not impact distributable of web.xml.
Product: Tomcat 7 Reporter: Keiichi Fujino <kfujino>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: trunk   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Keiichi Fujino 2010-08-05 22:06:15 UTC
Even if < distributable/> is set to web.xml(servlet3.0), 
distributable is changed from true to false by the annotation process of JAR. 

ContextConfig#processAnnotations is as follows. 
===ContextConfig#processAnnotations
protected void processAnnotations(Set<WebXml> fragments) {
    for(WebXml fragment : fragments) {
        if (!fragment.isMetadataComplete()) {
            WebXml annotations = new WebXml();
            URL url = fragment.getURL();
            processAnnotationsUrl(url, annotations);
            Set<WebXml> set = new HashSet<WebXml>();
            set.add(annotations);
            // Merge annotations into fragment - fragment takes priority
            fragment.merge(set);
        }
    }
}
===
distributable of "annotations" created by new WebXml() is false (default). 
If "annotations" is merged with "fragment", distributable of "fragment" becomes false. 

Because "fragment" is merged with web.xml of the web application,
even if < distributable/> is set to web.xml, distributable is changed from true to false. 

The following are necessary. 
annotations.setDistributable(true);

Best regards.
Comment 1 Keiichi Fujino 2010-08-05 22:23:16 UTC
Fixed in trunk.
This fix applied to 7.0, will be in 7.0.3 onwards.