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: Bill Shannon <bill.shannon_at_oracle.com>
Date: Wed, 30 May 2012 10:23:26 -0700

Greg Wilkins wrote on 5/30/12 1:29 AM:
> On 25 May 2012 23:12, Linda DeMichiel <linda.demichiel_at_oracle.com> wrote:
>
>> The Java EE 7 Platform spec Early Draft states the following (in section 8.5,
>> "Deployment"):
>>
>> "Note that the deployment descriptor version refers only to the version of the XML schema
>>
>> or DTD against which the descriptor is to be validated. It does not provide any
>> information as to what version of the Java EE platform the application is written to."
>>
>> I propose adding the following text:
>>
>> "In particular, the version of the deployment descriptor does not otherwise determine
>> what APIs or container features can or cannot be used or the semantics of those features."
>>
>> Do you all think that will be clear enough?
>
>
> It does make it clear enough. However, it does raise the question
> why do we support old XML versions if we don't guarantee that the
> semantics are identical.

The semantics of the descriptors and the APIs are supposed to be upwards
compatible. We're not perfect, but that's our goal. See my previous
message on this.

> Would it not make more sense to simply give a validation error if an
> old descriptor is deployed on a newer version? Given that we agree
> that behaviour can change, asking a user to update the web.xml may be
> a good way to ensure they understand this.

See my use case for why the version of the descriptor is unrelated
to the APIs available to the application.

We don't intend that the behavior of the descriptor changes from release
to release. The only issue I'm aware of that's even close to this is what
should happen if an application written for an older version of the spec
includes annotations that the older version of the spec didn't know about,
and is then run on a product that supports a newer version of the spec that
does know about such annotations. We would lose much of the ease of use of
annotations if developers were required to explicitly enable understanding
of annotations before they could use them. And it would be particularly bad
if an application that previously didn't need a descriptor because it was
using annotations suddenly was required to have a descriptor to enable use
of new annotations.

If you want to run an application in an environment that's limited to exactly
and only the features available in a previous version of a spec, run it on a
product that supports only that version of the spec. Products may also offer
modes that provide different environments limited to different versions of the
spec if they believe that this level of compatibility is important.