New to Jersey(REST Framework for Java) and I’m trying to setup two resources, in two separate classes that share a root path, and I’m having a problem.
So, I have something like:
@Path("/users")
public class User extends RestSupport {
@GET
@Path("/{user_uuid}")
public String get(@PathParam("user_uuid") String uuid) {
return "Hello User " + uuid;
}
}
The above class works. However, I want to create a child resource in a separate class. But when I do this, it seems to create a URI naming conflict. So, here, I want to get all the pets for a particular users
@Path("/users")
public class Pets extends RestSupport {
@GET
@Path("/{user_uuid}/pets")
public String get(@PathParam("user_uuid") String uuid) {
return "Hello Pets " + uuid;
}
}
These top-level resources have lots of child resources, so I’m looking for the best way to organize them. Any help would be appreciated.
Change the path of
Petsclass from@Path("/users")to
@Path("/users/{user_uuid}/pets")