users@jersey.java.net

Re: [Jersey] Issue with Routes and Collections using JAXB

From: Jason Winnebeck <gillius-ml_at_gillius.org>
Date: Fri, 09 Jul 2010 13:27:14 -0400

I'm not totally sure of the problem, other than the Customer method needs both
the @Path (which you have) and the @GET. But you said you tried it with the
@GET? My understanding about returning sub-resources comes from the Bookstore
example project where the bookstore Item (/items) was either a CD or a Book,
and only CDs had tracks (/items/123/tracks).

Jason

On 7/9/2010 1:21 PM, Basmajian, Raffi wrote:
>
> Good point, and you're right about the path, but I still can't seem to
> get this working.
>
> I tried the CustomersResource method, and while I can access /customers,
> /customer/{cid}, I can't get to /customer/{cid}/incident/{iid}
>
> I created a CustomersResource class like this:
> ==============================================
> @Produces("application/xml")
> @Path("/")
> @Singleton
> public class CustomersResource {
>
> @GET
> @Path("customer/{cid}")
> Customer getCustomer(@PathParam("cid") String cid)
>
> @GET
> @Path("customers")
> Collection<Customer> getCustomers
>
>
> And here is Customer...
> ================================================
> @Produces("application/xml")
> public class Customer {
>
> @Path("incident/{iid}")
> Incident getIncident(@PathParam("iid") String iid)
>
>
> While I can get the customer info I can't drill down to incidents. I
> tried using @GET but it still wont work.