1) I have 2 service classes with the following annotations:
@Path("/user/{userId}")
public class Foo {
@GET
@Path("/fooResourceA")
public FooResourceA fooResourceA();
@GET
@Path("/fooResourceB")
public FooResourceB fooResourceB();
}
@Path("/user/{userId}")
public class Bar {
@GET
@Path("/barResourceA")
public BarResourceA barResourceA();
@GET
@Path("/barResourceB")
public BarResourceB barResourceB();
}
When a request comes in the form of /user/1/barResourceA, the Bar
service class never gets checked for pattern match, and the client
gets a 404. Is this working as intended? I'm assuming I should stop
being lazy and create separate service classes for fooResourceA, etc.
with a class level @Path of "/user/{userId}/fooResourceA", etc.?
2) In the examples at
http://cxf.apache.org/docs/jax-rs-basics.html#JAX-RSBasics-Subresourcelocators,
what is the order of methods called on the deepest call?
(http://localhost:9000/customerservice/orders/223/products/323/items)
If, like the document implies, the call is a)
customerService.getOrder(orderId) and then b)
order.getItems(productId), then that's not a good thing, right?
because getItems(productId) returns "this", which is an object of type
Order, while presumably we're trying to get items?
Does the example actually want to remove the 2 getItems methods from
the Order object, have a Product object, and have items be a
sub-resource of Product? Or is this example trying to illustrate an
example that I have not yet understood?
3) While sub-resources are easy/good for GETs, what about
POST/PUT/DELETE? the usual getters and setters don't take care of
that very well, so we're going to have 4 methods per sub-resourced
field? Is that the usual usage, to put some object lifecycle
management methods into your POJO?
4) In a recent answer, you had the following code:
@Path("/fleets")
@Component
public class FleetResource {
@Autowired
BusResource busResource
@Path("/{fleet_id}/busses")
public BusResource getBusses() {
return busResource;
}
}
Is there somewhere that this functionality is documented (or where I
can look at the code?) The only way that I saw to do sub-resources
were to annotate in the POJO, but it looks like you can use a returned
@Component to have CXF continue resolving? For example, assuming like
you previous answer, that BusResource is annotated with a class level
@Path("/busses"). would a method level annotation of
@Path("{bus_Id)") be able to match /fleets/5/busses/1?
thanks!
Jeff Wang