users@servlet-spec.java.net

[servlet-spec users] Re: Should Servlet 3.0 compliant Web Container process @WebServlet annotation if app's web.xml is version 2.5?

From: Mark Thomas <markt_at_apache.org>
Date: Fri, 27 Apr 2012 08:24:21 +0100

On 27/04/2012 08:00, mims8010_at_gmail.com wrote:
> Hello,
>
> I need your expert opinion and clarification regarding the following
> extract from the Servlet 3.0 Specification:
>
> 1.6.2 Processing annotations
> In Servlet 2.5, metadata-complete only affected the scanning of
> annotations at
> deployment time. The notion of web-fragments did not exist in servlet
> 2.5. However
> in servlet 3.0 metadata-complete affects scanning of all annotations
> and webfragments
> at deployment time. The version of the descriptor MUST not affect which
> annotations you scan for in a web application. An implementation of a
> particular
> version of the specification MUST scan for all annotations supported in
> that
> configuration, unless metadata-complete is specified.
>
> Does this mean that if we have a web application with web.xml with
> version attribute 2.5, a servlet annotated with @WebServlet and
> metadata-complete is set to false,
> then should a Servlet 3.0 compliant Web Container process this
> @WebServlet annotation?

I wasn't part of the 3.0 EG so don't take this as definitive but my own
view would be "no" since if the web application declares itself as a 2.5
web application it should behave exactly the same way on a 2.5 container
and a 3.0 container.

This doesn't appear to be consistent with what is written above so some
clarification from the members of the 3.0 EG would be helpful.

What a 2.5 web application is doing using the 3.0 API is a separate
question and strikes me as a rather contrived example that shouldn't
happen. Either an application uses the 3.0 API and therefore needs to
declare itself as a 3.0 application or it is a 2.5 application and
should stick to the 2.5 API.

Mark