On 13/02/2015 17:59, Ryan Scharer wrote:
> Hey folks,
> 
> I'm not sure if this is a bug or not, but I can't find any relevant
> information in the spec to suggest the behavior is expected.
> 
> There's a web-fragment in my classpath that I'd like to skip. The only way
> to accomplish this that I know of is to put an <absolute-ordering> stanza
> in my web.xml and omit an <others/>. Though this has the desired effect of
> skipping the web-fragment I don't want, it has the very negative side
> effect that my ServletContainerInitializer doesn't get handed all instances
> of WebApplicationInitializer anymore, despite its @HandlesTypes annotation.
> If I add the <others/>, classpath scanning works fine, but the undesired
> web-fragment comes back. I've tested this in the latest 7.x and 8.x Tomcat
> releases.
> 
> 
> This begs two questions:
> 
>    1. Why does specifying an <absolute-ordering> without an <others/> kill
>    classpath scanning, or at least the part of Tomcat responsible for finding
>    types specified by @HandlesTypes and giving it to interested parties?

Because the Servlet spec says so.

Servlet 3.1, section 8.2.2, 1. d. (page 8-73)

"... Irrespective of the setting of metadata-complete, jars excluded by
<absolute-ordering> elements are not scanned for classes to be handled
by any ServletContainerInitializer."

>    2. Is there an alternate way to skip a web-fragment, short of ripping it
>    out of the jar, which I really don't want to do?

There is no way I am aware of that allows you to skip the
web-fragment.xml but still scan the JAR for SCIs and @HandlesTypes
matches to those SCIs.

Depending on what is in the web-frgament.xml you might be able to put
entries in the main web.xml to override them.

Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to