[jax-rs-spec users] [jsr339-experts] Re: Section 2.3.2 conflicts with third-parties

From: Bill Burke <>
Date: Mon, 04 Mar 2013 16:48:22 -0500

On 3/4/2013 4:42 PM, Sergey Beryozkin wrote:
> On 04/03/13 16:45, Bill Burke wrote:
>> myself and users have come across a situation where we want to include
>> an *optional*, non-annotated Application instance in our third-party
>> library distributions. The problem is section 2.3.2 states that all
>> Application classes have a servlet defined and added for them whether
>> they are annotated with @ApplicationPath or not. Those not annotated
>> that don't have a servlet mapping will cause a deployment exception.
> That is strange; should it be "/*" in this case ?

Nope, go read section 2.3.2. In this case, you are required to have a
servlet mapping or them.

>> IMO, this wording should be changed. If there is no servlet-mapping for
>> the automatically added servlet, then this should result in not
>> deploying the Application.
> I don't understand what it means - can you clarify please ?

If there is an Application class not annotated with @ApplicationPath and
it does not have a servlet mapping, then it should be ignored.
Otherwise, third-party jars can't have optional Application classes
within them.

If there is no Application class in the deployment, then the default
JAX-RS servlet should not be deployed unless there is a corresponding
servlet-mapping for it.

Bill Burke
JBoss, a division of Red Hat