jersey: composite resource
How can I have a resource that is a composite so that a GET to it returns a list of GET to all its subresources so that they can accept a GET also?
Having two methods like @Path("students") and @Path("student") with @QueryParam doesn't fit what I'm looking for, which is that the composite resource is just a dumb contain开发者_如何转开发er for heterogeneous resources.
If the resource has a method annotated with @Path, but no @GET, it is expected that the returned value is a resoruce (has @GET).
So something like (pseudocode):
@Path("resources")
class MyResource {
var subs = Map[String, AnyRef]()
@GET
def get = ...
@Path("{sub}")
def sub(@QueryParam("sub") sub: String) = subs(sub)
}
精彩评论