Well - I assume you have a @Path on each resource? This means you don't have to keep track of URLs across your entire application, rather just within each class - which is relatively easy if you annotate the interface.
Using enums won't work - you can only put contants into an annotation, but using a class holding final static String could work.
public class UrlConst {
public final static RESOURCE_MY_RESOURCE="/resource";
public final static RESOURCE_MY_RESOURCE2="/resource";
public final static OP_GET_ALL="/";
public final static OP_GET_BY_ID="/{id}";
}
@Path(UrlConst.RESOURCE_MY_RESOURCE)
public interface MyResource {
@GET
@Path(UrlConst.OP_GET_ALL)
@Produces(MediaType.APPLICATION_XML)
public ObjectList getAll();
@GET
@Path(UrlConst.OP_GET_BY_ID)
@Produces(MediaType.APPLICATION_XML)
public Object get(@PathParam("id") int id);
}
@Path(UrlConst.RESOURCE_MY_RESOURCE2)
public interface MyResource2 {
@GET
@Path(UrlConst.OP_GET_ALL)
@Produces(MediaType.APPLICATION_XML)
public ObjectList getAll();
@GET
@Path(UrlConst.OP_GET_BY_ID)
@Produces(MediaType.APPLICATION_XML)
public Object get(@PathParam("id") int id);
}
etc.