users@jersey.java.net

Issue with Routes and Collections using JAXB

From: Basmajian, Raffi <rbasmajian_at_oppenheimerfunds.com>
Date: Fri, 9 Jul 2010 11:37:42 -0400

Hello,
 
I'll try to keep this as simple as possible. We are implementing a REST
interface using Jersey for use in our customer service dept. "Customers"
call us with technical support issues and the issues are logged as
"incidents" in the system. So a customer has one-to-many with incidents.
 
We created a simple XSD schema conforming to the this sample XML:
 
<customer customerId="">
    <name>
    <incidents>
        <incident incidentId="">
        <incident incidentId="">
    </incident>
</customer>
 
We used the xjc utility from JAXB to create the annotated Java classes
for the schema. The classes generated were Customer, Incidents, and
Incident.
 
We created a CustomerResource class that handles the following routes:
 
@produces("application/xml)
@path("/")
class CustomerResource
 
@Path("customers/")
getCustomers()
 
@Path("customer/{cid}")
getCustomer(int cid)
    
We also want to implement a route to support getting a specific incident
for a customer, for example "/customer/100/incident/5", and we are not
sure how to do this. We are not sure if we have to create another
resource class for Incident, or, if we should create another method in
customerResource, such as getCustomerIncident(cid, iid), to handle it.
 
Thank you
Ra
 
 
 
 
 
 
 
 
sdf

------------------------------------------------------------------------------
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.
==============================================================================