users@jersey.java.net

[Jersey] Adding grammar to the resources

From: Nick Khamis <symack_at_gmail.com>
Date: Mon, 29 Jul 2013 15:07:43 -0400

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.


Kind Regards,

Nick.