The use of an <absolute-ordering> element does disable ServletContainerInitializer classpath scanning as discussed also in issue 53619. However, it does seem to require having at least one web-fragment name to be listed. In other words I would this: <absolute-ordering /> To turn off all web-fragments since none are named. A workaround is to list a web-fragment even if it doesn't exist but that shouldn't be necessary.
Created attachment 29736 [details] resources1.jar Confirming. Steps to reproduce with 7.0.34: 1. Download attached resources1.jar and put it into webapps/examples/WEB-INF/lib The file is based on test/webapp-3.0-fragments/WEB-INF/lib/resources.jar from Tomcat sources. I a) removed all resources except "resourceA.jsp" and b) declared an instance of HelloWorldServlet in web-fragment.xml. 2. Edit webapps/examples/WEB-INF/web.xml: a) change metadata-complete attribute s/true/false/ b) add <absolute-ordering /> 3. Start Tomcat. 4. Actual result: The following two URLs work: [1] http://localhost:8080/examples/resourceA.jsp [2] http://localhost:8080/examples/resources1/HelloWorldExample Expected result: [2] should return 404 as web-fragment.xml should be ignored and the servlet mapping declared there should be ignored. <quote from="Servet Spec 3.0 Rev a - page #67 (89/230)"> 1.d. (..) If the <absolute-ordering> element does not contain an <others/> element, any web-fragment not specifically mentioned within <name /> elements MUST be ignored. (...) </quote> Regarding [1], I do not see any specific reference that such exclusion affects static resources in META-INF/resources. Thus I think that the expected behaviour of [1] is to display resourcesA.jsp page. 7.0.34 behaves correctly here.
Hi, I'm going to work on this. Regards Violeta
Created attachment 29811 [details] Patch proposal
Created attachment 29812 [details] Test case
Please find attached a patch proposal and a test case for it. Any comments will be appreciated. Regards Violeta
Created attachment 29813 [details] resources.jar resources.jar should be placed in <TC7-Trunk>/test/webapp-3.0-fragments-empty-absolute-ordering/WEB-INF/lib
Thanks for the patch. It has been applied - with some minor changes to trunk and 7.0.x and will be included in 7.0.35 onwards.
And what about {tomcat.dist}/lib dir? Because those services are loaded anyway. Debugging and watching the code of "WebappServiceLoader" and a google search with "containerSciFilter", I see that I can use a Pattern to exclude that classes. Is the only way? Thanks.