users@jersey.java.net

[Jersey] Re: Two endpoints with a common URI prefix

From: Kevin Hale Boyes <kcboyes_at_gmail.com>
Date: Mon, 16 Jun 2014 21:30:12 -0600

On 16 June 2014 02:46, Marek Potociar <marek.potociar_at_oracle.com> wrote:

>
> On 11 Jun 2014, at 20:46, Kevin Hale Boyes <kcboyes_at_gmail.com> wrote:
>
>
> > Why can't I have the same @Path in different classes?
>
> You can - since JAX-RS 2.0 / Jersey 2.x. JAX-RS 1.1 / Jersey 1.x does not
> support this. But you can specify the version as a path template and that
> should work:
>
> @Path("scm/{version}/invoices")
> InvoicesResource
>
> @Path("scm/{version}/orders")
> OrdersResource
>
>
This matches the response from Simon and has been very helpful. Thanks to
you both.
I've been trying to find time to upgrade to JAX-RS 2.0 and this gives me
another reason to do so.


> > Why can't I just remove the class level @Path annotation and have the
> full URI at the class level?
>
> Not sure I get this one. Can you elaborate, please?
>

Since I couldn't figure out how to have the same path for two different
classes I'd wondered if I could simply remove the @Path at the class level
and put the entire path into each @Path for the methods.

Thanks for your help.
Kevin.