users@jersey.java.net

[Jersey] Rules for selecting resource methods?

From: Joseph Mocker <jmocker_at_velti.com>
Date: Tue, 2 Jul 2013 15:36:58 -0700

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