Hi all,
I have a seemingly simple JAX-RS question, but, for some reason, I
cannot figure it out.
Assume a simple REST order service.
GET /order should return a list of all current orders, while
GET /order/{id} should return the details of the order with the id {id}.
How would I annotate this in JAX-RS / CXF? My simple approach
<snip>
@Path("/")
public class OrderService {
@GET
@Path(value="/order", limited=true)
public List<Order> getOrders() {
....
}
@GET
@Path(value="/order/{id}", limited=true)
public Order getOrder(@PathParam("id") String id) {
....
}
}
</snip>
does not seem to work, because the mapping '/order/{id}' seems to
match both request types from above (and I get a NPE for GET /order).
Why is this the case? To me this behavior seems counter-intuitive,
since intuitively @Path(value="/order") seems like a 'better' match
for GET /order than @Path(value="/order/{id}") ...
Can somebody please shed a light on this?
/philipp