users@jersey.java.net

Re: [Jersey] JSONP

From: Jakub Podlesak <Jakub.Podlesak_at_Sun.COM>
Date: Wed, 20 Jan 2010 17:01:41 +0100

On Wed, Jan 20, 2010 at 10:16:04AM -0500, Ben Darfler wrote:
> Forgive this question as it might not make sense yet but I'm trying to
> wade through this.

No problem, your question makes perfect sense.

>
> I'm currently using jackson as the json provider for jersey. We have
> an interest in supporting JSONP and I'm wondering if there is a way to
> do this. I've found JSONWithPadding class in Jersey that seems to

The JSONWithPaddingWrapper is exactly what you need.

> suggest a way of doing this but I'm not sure of the syntax. Previous I
> would just return a map from my restful method and jackson/jersey
> would take care of the serialization. However, if I change the method
> to return new JSONWithPadding(map) it fails and I'm not easily able to
> figure out why. My gut says that I need to add JAXB annotations to my

From your description it seems, you use the wrapper the way it was intended.
There should be no need for any extra annotations. What kind of failure are you getting?
Any exception stack trace?

> objects which I have been able to avoid so far. Is there any way of
> doing jsonp with jackson as the json provider for jersey? (whew thats

It is possible that you revealed a bug in the JSONP support in Jersey,
what kind of map do you use? I need to add a test for this, as so far
only the JAXB based scenario has been tested.

> a lot of buzz words).
>
> I asked the jackson mailer and they are interested in helping out on
> this if anything needs to be done on their side.

Thanks for the info, i will contact Tatu, if there is a need.

~Jakub

>
> http://archive.codehaus.org/lists/org.codehaus.jackson.user/msg/5f7770581001191408m3659e3e4w608b294ce6041947@mail.gmail.com
>
> Ben
>
>
> --
> Software Engineer
> LocaModa
> Connecting People & Places
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
http://blogs.sun.com/japod