users@jersey.java.net

[Jersey] Re: Inheritance and Internal Classes

From: <ghellings_at_onenetwork.com>
Date: Mon, 27 Dec 2010 22:52:17 +0000 (GMT)

So is it OK, then, to have this:

A.java:
abstract class A {
  @GET
  public String get() {
    return "get";
  }
  @POST
  public String post() {
    return "post";
  }
}

B.java:
@Path("b")
public class B extends A {
}

C.java:
@Path("c")
public class C extends A {
}

Notice that there is no @Path on A, nor are there any member methods
declared inside of B or C as they inherit their POST and GET methods
from A. This is the current setup I am using, and my client is not
seeing the endpoints still. I am not sure if the problem is just on my
end or if Jersey does not support this construct and wanted to check
before I got too much further.

--Greg