users@jersey.java.net

[Jersey] Re: One domain model, multiple json views

From: Arul Dhesiaseelan <aruld_at_acm.org>
Date: Sat, 26 May 2012 19:28:42 -1000

Google Drive API does something similar by passing in an optional parameter
in the request that hints what response data is expected by the target
client.

https://developers.google.com/drive/v1/reference/files/get

Does this work for you?

-Arul

On Sat, May 26, 2012 at 8:26 AM, <rick_at_broadcastr.com> wrote:

> Hi, I asked this question on stackoverflow, but thought I would send it
> here as well..
>
> We have a set of domain classes which are serialized to json via
> jackson using jersey services. We are currently annotating the classes
> with JAXB (although we're not tied to that). This works fine. But we
> want to offer different serializations of the classes for different use
> cases.
>
> Web site
> Mobile apps
> Admin tool
> Public API
>
> In each of these use cases there are different fields which we may or
> may not want included in the json view. For example, the admin tool
> might need some parameters for setting permissions on data. The mobile
> client needs a different URL to a media stream than the website. The
> website has particular naming conventions it needs for fields.
>
> What is the best practice for managing different mappings of json for
> different service endpoints in Jersey?
>
> Thanks!
>



-- 
http://aruld.info
http://twitter.com/aruld