I forgot to say the important part :(
ERROR com.sun.jersey.spi.container.ContainerRequest (436) A message
body reader for Java class SubResource, and Java type class
SubResource, and MIME media type application/octet-stream was not
found
the warning I posted may just be a warning that I can ignore ... but
... the SubResource is in the same package as the TopResource, I'm not
sure why it wouldn't be recognized by jersey as a sub-resource rather
than a bean class.
On Wed, Dec 8, 2010 at 1:02 PM, Christopher Piggott <cpiggott_at_gmail.com> wrote:
> I've been reading old posts to the mailing list, trying to figure out
> if I'm doing this right. I think I am:
>
>
>
> import com.google.inject.Inject;
>
> @RequestScoped
> @Path("/items")
> public class TopResource {
> @GET
> @Path("{itemId}")
> @Inject
> public SubResource getItem(SubResource injectedSub)
> {
> return injectedSub;
> }
> }
>
>
>
> @RequestScoped
> public class SubResource {
> @PathParam("itemId") int itemId;
>
> @GET
> public String get()
> {
> return "Your item is number " + itemId;
> }
> }
>
>
>
> I think that should work. I can tell you for sure the following:
> * The TopResource is being created
> * An instance of SubResource is being created through injection
> * in the sub-resource, itemId is 0 ... so that's not working
>
> But the main problem I'm having is:
>
> WARN com.sun.jersey.spi.inject.Errors (173) The following warnings
> have been detected with resource and/or provider classes:
> WARNING: A HTTP GET method, public SubResource
> TopResource.get(SubResource), should not consume any entity.
>
>
> I read about a similar problem with "should not consume any entity"
> relating to MatrixParam but all I'm trying to do is pass down a path
> parameter. Shouldn't that be OK?
>
> --Chris
>