On 7/29/2013 3:07 PM, Nick Khamis wrote:
> Hello Everyone,
>
> I am trying to setup the following URL structure:
>
> .../rs/wines/ : Lists all wines
> .../rs/wines?name=REX
> .../rs/wines?id=10
>
> I tried the following:
>
> @GET
> @Produces({MediaType.APPLICATION_JSON})
> public List<Wine> findAll()
>
> @GET @Path("{name}")
> @Produces({MediaType.APPLICATION_JSON})
> public List<Wine> findByName(@QueryParam("name") String name)
>
>
> @GET @Path("{id}")
> @Produces({MediaType.APPLICATION_JSON})
> public Wine findById(@QueryParam("id") String id)
>
>
> But I am getting the following error: ambiguous (sub-)resource method
> for HTTP method GET
>
> Can some one please explain how to do this properly? Even better a
> standard example
> that touches on the possibilities would be lovely.
Why do you have @Path annotations on the last two? According to your
examples, name and id are QueryParams, not part of the path. So, you
only have one path, with two QueryParams.
--
Guy Rouillier