users@jersey.java.net

[Jersey] Re: jersey-guice inject subresources

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Wed, 8 Dec 2010 15:44:37 -0500

Perhaps I need to better understand something. When everything
starts, I can see:

INFO com.sun.jersey.api.core.ScanningResourceConfig (132) Root
resource classes found

followed by a list of all of my root resources. However, nowhere does
it ever tell me about sub-resources. I deduce that when the root
resources are scanned, somebody will notice what looks like a
sub-resource method that returns some class. What I would hope is
that, at this point, it would figure out that class is actually a
sub-resource, as determined by the fact that it contains methods with
@GET, @POST, etc.

Is that how it's supposed to work?

The problem I'm having appears to be entirely caused by it not
realizing that the thing the root resource method is returning is, in
fact, a subresource ... so it is attempting to find a
MessageBodyWriter that knows how to turn that instance into something
(text, xml, json, whatever) -- and it cannot find one so it just stops
with a com.sun.jersey.api.MessageException complaining there is no
message body writer to choose from.