I know you can define different media type handlers for two or more methods. My question on the rest-discuss list is how to actually send back the media type info for each URI. In your case, you'd want to some how provide two URIs that indicate two different media types that can be called. The client side would set the Content-Type to the media type for the URI it is going to call, and in your jesery code you simply set the @Consumes to the specific media type so that jersey can direct the incoming request to the right @GET method.
At least, I think that is how it works. Waiting on a response on the proper way to send back a HATEOAS that includes the link, media type to set the Content-Type to, and method to use (get/post/etc). Still a bit confused on how all this gets mixed together.
--- On Tue, 2/23/10, Dário Abdulrehman <dario.rehman_at_gmail.com> wrote:
From: Dário Abdulrehman <dario.rehman_at_gmail.com>
Subject: [Jersey] Root resource class question
To: users_at_jersey.dev.java.net
Date: Tuesday, February 23, 2010, 6:35 AM
Is it possible to define a single root resource class that matches both:
GET /proteins?protein=proteinid1&protein=proteinid2&...
GET/protein/proteinid
@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