users@jersey.java.net

Re: [Jersey] Root resource class question

From: Jan Algermissen <algermissen1971_at_mac.com>
Date: Tue, 23 Feb 2010 15:45:13 +0100

On Feb 23, 2010, at 3:35 PM, Dário Abdulrehman wrote:

> Is it possible to define a single root resource class that matches both:
>
> GET /proteins?protein=proteinid1&protein=proteinid2&...
> GET/protein/proteinid

I'd change the URL for the second one as to have

> GET /proteins?protein=proteinid1&protein=proteinid2&...
> GET /proteins/proteinid


And then I'd use a resource class on /proteins with a method that handles the params and provide a method for the sub resource /proteins/{id}

Jan



>
> @Path(?)
> public Class ...
>
> and define two @GET methods for each case?
>
> Conceptually they are the same resource but one works with lists and the other with single objects.
>
> Thanks,
> Dário

-----------------------------------
 Jan Algermissen, Consultant
 NORD Software Consulting

 Mail: algermissen_at_acm.org
 Blog: http://www.nordsc.com/blog/
 Work: http://www.nordsc.com/
-----------------------------------