users@jersey.java.net

Re: [Jersey] Selecting subrule by _at_QueryParam

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Fri, 26 Jun 2009 09:49:39 +0200

On Jun 26, 2009, at 9:36 AM, Martin Probst wrote:

> Hi,
>
> I have two classes like this:
>
> class A {
> @GET
> Response doFoo(@QueryParam("param") String param) { ... }
> }
>
> class B extends A {
> @GET
> Response doGet() { ... }
> }
>
> (I'm not sure the inheritance thing has anything to do with it, need
> to test that).
>
> So I have two methods on the Resource, both of which support a @GET
> request, but one of them takes a ?param=value parameter. Is this
> possible at all in JAX-RS?

No, resource methods are inherited, so in this case there is a
conflict as JAX-RS container does not know which resource method to
utilize for a GET request.


> Or do I need to disambiguate by path or
> similar?
>

You need to disambiguate using @Path, or override and ignore the query
parameter value.

Paul.