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.
-----Original Message-----
From: Jason Winnebeck [mailto:gillius-ml_at_gillius.org]
Sent: Friday, July 09, 2010 1:08 PM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Issue with Routes and Collections using JAXB
Paths are always relative, if that helps. I believe a @GET method
without a @Path means the root of that context. If you return a resource
from a resource, that resource's URLs will be relative. I think that's a
good thing from an abstraction perspective, the Incidents defines a URL
structure "/incident/{iid}", but doesn't say how it is rooted. So when
it's returned from a Customer, then it is
/customer/{cid}/incident/{iid}, but Incidents doesn't care about that.
So if you want to return incidents from a company
(/company/{cName}/incident/{iid}), you can do that without changing the
Incidents resource class -- you just are returning it from two different
places now.
I'm still playing around with Jersey "academically" and haven't done a
real-world project with it yet, but what I said is based on what I've
figured out so far, and it seems practical to apply in a real
application.
Jason
On 7/9/2010 12:36 PM, Basmajian, Raffi wrote:
>
> Ok, thanks for the tip.
>
> One other question, if I decide to annotate at the POJO level, is it
> required to set the @Path("") configuration in each resource to
> reflect the object hierarchy, or is that handled automatically by
Jersey?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
For additional commands, e-mail: users-help_at_jersey.dev.java.net
------------------------------------------------------------------------------
This e-mail transmission may contain information that is proprietary, privileged and/or confidential and is intended exclusively for the person(s) to whom it is addressed. Any use, copying, retention or disclosure by any person other than the intended recipient or the intended recipient's designees is strictly prohibited. If you are not the intended recipient or their designee, please notify the sender immediately by return e-mail and delete all copies. OppenheimerFunds may, at its sole discretion, monitor, review, retain and/or disclose the content of all email communications.
==============================================================================