dev@jersey.java.net

JSONP wrapper for Jackson (JSONPObject.java)

From: Tatu Saloranta <tsaloranta_at_gmail.com>
Date: Sun, 7 Feb 2010 16:05:49 -0800

Ok, as per Jackson issue
[http://jira.codehaus.org/browse/JACKSON-234], I thought it would
actually be nice to have a wrapper a wrapper object that Jackson knows
how to serialize as JSONP wrapping. I am hoping this would work well
with Jersey JSONP integration.
But as additional bonus, it will be possible to also then do wrapping
without framework having to explicitly enable/disable it.

Amount of code that was needed was trivial (for once I am happy I
added JsonGenerator.writeRaw(), which works nicely here), so let me
know if you have improvement ideas.

Jakub, Paul: do you think this would work wrt. earlier discussion on
how to handle JSONP integration? I added code in core mapper module
since it seemed general-enough-purpose to warrant inclusion.

Addition will be in version 1.5.0, since I don't add new functionality
in patch releases (even safe ones like this would be), because of
confusion it could happen (1.4.3 having JSONP support, 1.4.2 not --
patch releases should be interchangeable minus bug fixes). So it might
take a while to get it used by Jersey. But I am hoping basic idea
would work.

-+ Tatu +-