users@jersey.java.net

Re: [Jersey] Methods with same annotations

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 27 Jan 2009 13:52:56 +0100

On Jan 27, 2009, at 1:40 PM, amsmota_at_gmail.com wrote:

> I have a doubt here I don't know if JSR-311 or Jersey specific.
>
> Should we allow two methods defined with the same annotations, and
> differentiate then by the *name* (or/and number) of the params?
>
> @POST
> @Path="/service/test"
> void testThis(@FormaParam("test1")String test)
>
> @POST
> @Path="/service/test"
> void testThat(@FormaParam("test2")String test)
>
> So that
>
> POST /service/test
> test1=testing
>
> get's the testThis method and
>
> POST /service/test
> test2=testing
>
> get's the testThat method?
>
> Or it should throw a error?


Dispatching is only performed on the path and what is media produced
and consumed. JAX-RS does not specify a dispatching mechanism for
parameters whether they be form or say query parameters.

Jersey should warn you that there are two ambiguous resource methods.
It seems it does not. Jakub, can you look into this?

Paul.