Joseph,
An alternative approach...
You could send in a representation that contains (only?) a link to the
resource that you want to use as a source.
A quick review of the IANA link registry reveals nothing exact, you
could perhaps use 'via' or 'related'. Alternatively, you could define
an suitable extension relation (as RFC5988) e.g.
http://relations.example.com/source (or similar).
It seems to me that "copy" is *just* creation of a new resource that
gets its data from a specified source.
This pattern would also allow to copy resources from outside your domain.
Best
Paul
On 2 Jul 2013, at 23:37, Joseph Mocker <jmocker_at_velti.com> wrote:
> Hi,
>
> I am looking for the rules about how Jersey selects the resource method to service a request. I know the @Path, Http Method, @Consumes and @Produces are all used to select a resource method. Are there any other attributes of the request like Headers for example, which I can use to influence the selection process?
>
> I am trying to define a pattern for copying or duplicating an entity, where I simply reference the original entity somehow instead of passing in the entire entity as in the normal "create" Resource. There are three ideas I've bounced around to implement this
>
> 1. just use a different @Consumes type, such url form encoded and define a separate Resource method to handle it
> 2. pass in a header such as "X-Copy-Entity" and pass in different payload data representing source, and having Jersey automatically select it somehow
> 3. define a new Http Method to designate a Copy and figure out how to get Jersey to recognize it in resource method selection
>
> Has anyone run up against trying to do something like this?
>
> Thanks…
>
> --joe
>
> Joseph Mocker | Velti | Senior Software Architect
> t +1.650.566.7033 m
> e jmocker_at_velti.com @Mobclix
>
> The leading global technology provider of
> mobile marketing and advertising solutions
>