users@jersey.java.net

[Jersey] Re: _at_ParentRef in a CDI/glassfish environment

From: Christopher Piggott <cpiggott_at_gmail.com>
Date: Thu, 30 Aug 2012 07:53:28 -0400

Mark,

I don't understand something. Your thought is that the subresources
should get everything they need from the context. Suppose I have this
path:

    /customers/{customerId}/orders/{orderId}/shipping

Let's say shipping is a subresource. For some reason, the shipping
resource needs to know the CustomerID.

How does he get it? He can get the entire URI by injecting it, but he
shouldn't have to know how to parse all these things above him. He
just needs to somehow do something like:

public class ShippingSubResource {
   @GET
    public Response someShippingMehod (
        @PathParam("customerId") String customerId;
    ) { ... }
}

even though he has no @Path, and the PathParam he's looking from comes
from somewhere several subresources above him (possibly even the root
resource).