Hi Jason,
Thanks for the quick reply.
I also felt that adding getCustomerIncident(cid,iid) in CustomerResource
was putting too much in that one class.
It feels more natural placing the routes in the classes relative to the
resources they are serving.
I'll give it a shot with the CustomersResource class.
Thanks
Raffi
-----Original Message-----
From: Jason Winnebeck [mailto:gillius-ml_at_gillius.org]
Sent: Friday, July 09, 2010 11:47 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Issue with Routes and Collections using JAXB
I am sort of new to Jersey, but from what I saw in the Bookstore
example:
If you rename your CustomerResource to CustomersResource (representing
multiple customers) and its getCustomer(int cid) returns a new class
CustomerResource (representing a SINGLE customer) with a
@path("incidents") and a @path("incident/{incidentId}") then that is one
possibly technique.
I think it would also work to have a method in your original
CustomerResource with @path("customer/{cid}/incident/{incidentId}").
It's up to your design -- are you putting too much in one class if you
did that?
So you can have just one class CustomerResource with everything, or you
can have as any levels as you want. If you went all the way you would
have:
Customers -> Customer -> Incidents -> Incident (each having
@Path-annotated methods returning the lower level).
Jason
On 7/9/2010 11:37 AM, Basmajian, Raffi wrote:
> 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.
---------------------------------------------------------------------
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.
==============================================================================