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: Jan Bartel <janb_at_intalio.com>
Date: Fri, 25 May 2012 10:22:43 +0200

Rajiv,

On 24 May 2012 23:59, Rajiv Mordani <rajiv.mordani_at_oracle.com> wrote:
> Including Bill and Kin-man to this thread. Bill feel free to add more
> details as you have more context in all of the platform.
>
>
> On 5/24/12 6:48 AM, Mark Thomas wrote:
>>
>> On 24/05/2012 06:36, rajiv.mordani_at_oracle.com wrote:
>>>
>>> The version of the deployment descriptor does not determine what
>>> features from the container can and cannot be used.
>>
>> That is unexpected for two reasons.
>
>
> This is and has been the expectation from the entire platform for a long
> time. We are in the process of clarifying it in the platform spec as well to
> be explicit. If for some reason the current EL EG is not following this we
> need to fix this.
>
>
>>
>> 1. The JSP EG took the opposite view regarding EL expressions.
>>
>> 2. It means an application that declares itself to be a 2.5 application
>> may behave differently on a 3.0 Servlet container than a 2.5 servlet
>> container due to the presence of annotations. Depending on where the
>> annotations are, that may be unexpected.
>
>
> The application would explicitly use an annotation in the code - so the
> behavior will be expected by the application by the fact that it used the
> particular annotation.

Not necessarily. As per http://java.net/jira/browse/SERVLET_SPEC-36, a
servlet 3.0 container is required to look for
ServletContextInitializers inside WEB-INF/lib jars. If an application
uses a jar that happens to have one of these then when the app is
deployed on a 2.5 compliant container it may have different and
unexpected behaviour on a servlet 3.0 container. Unless a user sees
the source of all the jars in WEB-INF/lib there's no way for them to
know that such annotations are present.


Jan