users@jersey.java.net

[Jersey] Re: how to produce JSONP

From: Jakub Podlesak <jakub.podlesak_at_oracle.com>
Date: Mon, 05 Sep 2011 15:44:28 +0200

Hi Leonardo,

You may want to utilize the JSONWithPadding wrapper (see [1]).
There is an example at [2].

~Jakub

[1]http://jersey.java.net/nonav/apidocs/latest/jersey/com/sun/jersey/api/json/JSONWithPadding.html
[2]https://maven.java.net/content/repositories/releases/com/sun/jersey/samples/jsonp/1.9/jsonp-1.9-project.zip

On 5.9.2011 14:11, Leonardo wrote:
> Hello everyone.
>
> @Produces allows me to change from default XML to JSON, so i can
> translate java objects into javascript objects in a very standard and
> transparent way.
>
> Now i need to generate JSON with padding, in other words surround the
> root object with an arbitrary callback function.
>
> Any guidance? can the serializer in charge of json construction
> receive this modification easily?
>