users@jersey.java.net

Re: [Jersey] Root resource class question

From: Dário Abdulrehman <dario.rehman_at_gmail.com>
Date: Tue, 23 Feb 2010 16:37:53 +0000

I thought it would be best to provide two distinct URLs for single and
multiple proteins .
http://blog.roberthahn.ca/articles/2007/04/06/url-design/ (though this is no
authoritative source)

Are there any style guidelines for URL design?

Thanks,
Dário

On Tue, Feb 23, 2010 at 3:31 PM, Marc Hadley <Marc.Hadley_at_sun.com> wrote:

> On Feb 23, 2010, at 9:35 AM, 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
> >
> > @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.
> >
> Its possible like this:
>
> @Path("/")
> pubic class ProteinResource {
>
> @GET @Path("proteins")
> public getList(...) {...}
>
> @GET @Path("protein")
> public getSingle(...) {...}
> }
>
> But I think Jan's suggestion is much better.
>
> Marc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>