Hello,
I have following endpoints I want to provide:
(IMyEndpoint interface)
/myendpoint
/myendpoint/{id}
(ISubendpoint interface)
/myendpoint/{id}/subendpoint
/myendpoint/{id}/subendpoint/{subid}
(IOtherSubendpoint interface)
/myendpoint/{id}/othersubendpoint/{othersubid}
/myendpoint/{id}/othersubendpoint/{othersubid}
For a better separation of concerns and to keep the resource implementation
simple,
I would like to divide this list of endpoints in 3 resource interfaces.
I set @Path annotation on the interface always "" because I expose the
endpoint with the
org.apache.cxf.rs.address property.
(If there is a better way then this I would like to know as well)
However if I use the following resource definitions, CXF search for the
"/myendpoint/{id}/subendpoint" in the MyEndpoint Resource instead of
Subendpoint resource and it results with 404.
@Path("") // is this correct or is there a better way to do this?
public interface IMyEndpoint {
@GET
public Response getAll();
@GET
@Path("{id}")
public Response getById(@PathParam("id")String id);
}
@Component
@Properties({
@Property(name = "org.apache.cxf.rs.address", value = "/myendpoint")
})
public class MyEndpoint implements IMyEndpoint {
...
}
@Path("")
public interface ISubendpoint {
@GET
public Response getAll();
@GET
@Path("{subid}")
public Response getById(@PathParam("id")String id,
@PathParam("subid")String subid);
}
@Component
@Properties({
@Property(name = "org.apache.cxf.rs.address", value =
"/myendpoint/{id}/subendpoint")
})
public class Subendpoint implements ISubendpoint {
...
}
CXF has a documentation for Selection algorithm but I am not sure how to
make it work with DOSGI:
https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Basics#JAX-RSBasics-Overviewoftheselectionalgorithm.
If I put everything under IMyEndpoint interface and use path annotations on
methods, then it works.
Could anyone help me to make it works in a modular way?
--
Sent from: http://cxf.547215.n5.nabble.com/cxf-user-f547216.html