On 30/05/2013 21:04, Nick Williams wrote: > > On May 29, 2013, at 6:58 AM, Pid wrote: > >> On 29/05/2013 00:24, Nick Williams wrote: >>> Guys, >>> >>> Can some of the fine experts on this list double check my >>> assertions below and let me know if I'm going wrong anywhere? I >>> hope I got it all right. :-) >>> >>> Assertion #1 If metadata-complete="true" is present in the >>> deployment descriptor: A) The container does NOT scan >>> /WEB-INF/classes for annotations, B) The container does NOT scan >>> /WEB-INF/lib JARs for ServletContainerInitializers, >> >> "The metadata-complete and invocation of >> ServletContainerInitializers are independent." >> >> https://java.net/jira/browse/SERVLET_SPEC-36 > > Thanks. I'm assuming that I got everything else correct since this is > the only thing you corrected and nobody else replied.
Or pid just stopped at the first invalid assumption ;) > But I want to make sure I understand the discussion at this link > correctly. Rajiv says here: "Ordering does not apply to > ServletContainerInitializers." Is that really correct? There's really > no way at all to order the invocation of > ServletContainerInitializers' onStartup methods??? Mark, you seemed > to be involved in this discussion a lot. Is this really true??? If that is what the spec lead says then yes. Tomcat will process them in the order they are found: i.e. respecting the fragment order but you can't rely on a) any other container doing the same, b) Tomcat continuing to do the same (although it is unlikely to change unless a spec feature mandates a change) >>> C) The container does NOT scan /WEB-INF/lib JARs for >>> web-fragment.xml files False. The scan still occurs because the ordering elements determines whether or not SCIs are scanned for. , and D) The container does NOT scan >>> /WEB-INF/lib JARs for annotations. >>> >>> Assertion #2 If class loading is configured "parent last," the >>> ServletContainerInitializers in the application are fired before >>> ServletContainerInitializers provided by the container. If class >>> loading is configured "parent first", the >>> ServletContainerInitializers provided by the container fire >>> before the ServletContainerInitializers in the application. False. Ordering of SCIs from the container is undefined, as is the mechanism by which they get added to the app. It is a container specific process. >>> Assertion #3 ServletContainerInitializers in the container and in >>> /WEB-INF/lib JARs are fired before any ServletContextListeners. >>> The order in which they are fired is determined by >>> <absolute-ordering> (web.xml) and/or <order> (web-fragment.xml), >>> but if neither of those are present the order is unspecified. Listeners defined in a single web[-fragment].xml will be fired in the order they are defined. >>> Assertion #4 The init methods of ServletContextListeners declared >>> in the container, in /WEB-INF/classes, and in /WEB-INF/lib JARS >>> are all fired BEFORE the init methods of any Filters or Servlets. >>> The destroy methods of ServletContextListeners declared in the >>> container, in /WEB-INF/classes, and in /WEB-INF/lib JARs are all >>> fired AFTER the destroy methods of any Filters or Servlets. >>> >>> Assertion #5 The init methods of Filters declared in the >>> container, in /WEB-INF/classes, and in /WEB-INF/lib JARs are all >>> fired BEFORE the init methods of any Servlets. The destroy >>> methods of Filters declared in the container, in >>> /WEB-INF/classes, and in /WEB-INF/lib JARs are all fired AFTER >>> the destroy methods of any Servlets. >>> >>> Assertion #6 If any given ServletContainerInitializer is the >>> first ServletContainerInitializer to be fired when an application >>> starts up, and that ServletContainerInitializer adds a >>> ServletContextListener and a Filter to the ServletContext: A) The >>> Listener it adds will be the first Listener whose init method is >>> called and the last Listener whose destroy method is called, False. >>> B) >>> The Filter it adds will be the first Filter whose init method is >>> called and the last Filter whose destroy method is called, and It depends. Look for isMatchAfter C) >>> The Filter will be the first Filter on the Filter chain, always. False. The detail for all of the above is in the spec. Mark --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org