You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Sergey Beryozkin <sb...@gmail.com> on 2011/04/10 18:56:58 UTC

Re: JSON with padding with jaxrs

Hi Josh

I've decided to apply your patch, given that it can be handy for CXF users
to just add few CXF interceptors and have it working across different
deployment platforms, with/without Servlet filters be available. The
interceptors are very simple,  but they are configurable, and may be
something more sophisticated can be supported in time. Updated documentation
is at [1] - if you have some ideas on how to improve those interceptors then
let me know please

thanks, Sergey

[1]
https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Data+Bindings#JAX-RSDataBindings-JSONWithPadding

On Sun, Jan 16, 2011 at 6:33 PM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Josh
>
> I've added some initial documentation about JSONP [1] where I included the
> code fragment from [2] but also linked to your blog post.
>
> I think it may still make sense to apply your patch. CXF JAX-RS users would
> probably appreciate if they could register JSONP CXF interceptors while
> configuring a given endpoint from Spring. I'll look into the possibility of
> applying the patch
>
>
> thanks, Sergey
>
> [1]
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Data+Bindings#JAX-RSDataBindings-JSONWithPadding
> [2] https://issues.apache.org/jira/browse/CXF-3005.
>
> On Sat, Jan 15, 2011 at 9:50 PM, Josh Holtzman <jh...@berkeley.edu>wrote:
>
>> I haven't implemented the improvements in the patch because I found it
>> easier to actually add the padding via a servlet filter.  This way,
>> regardless of what technology you use, CXF, Servlet, Jettison or Jackson,
>> the filter can intercept the response and wrap it.  I wrote up a more
>> thorough description at [1].
>>
>> Hope this helps,
>> Josh
>>
>> [1] http://josh.media.berkeley.edu/?p=78
>>
>>
>> On Sat, Jan 15, 2011 at 7:01 PM, Sergey Beryozkin <sberyozkin@gmail.com
>> >wrote:
>>
>> > Hi
>> >
>> > On Fri, Jan 14, 2011 at 6:51 PM, James Carr <ja...@gmail.com>
>> > wrote:
>> >
>> > > Not to resurrect old threads, but I'm curious if it has been enabled?
>> > >
>> >
>> > Please see https://issues.apache.org/jira/browse/CXF-3005.
>> > Josh H. has submitted a patch which I believe should work with
>> JSONProvider
>> > (Jettison), Jackson, etc.
>> >
>> > Dobes V. has commented on how to do it by extending the default
>> > JSONProvider. I'll update the docs... Dobes, by the way, the
>> JSONProvider
>> > subclasses can do getContext().getHttpServletRequest(), where
>> getContext()
>> > returns a custom CXF MessageContext...
>> >
>> > Josh - I'll probably go ahead and commit a patch. I can update it to do
>> an
>> > extra check for application/javascript. I know you were thinking about
>> > enhancing the patch but may be you can do it after I check in your
>> current
>> > one ?
>> >
>> > thanks, Sergey
>> >
>> > I know Jersey does support it with a little bit of work.
>> > >
>> > > Thanks,
>> > > James
>> > >
>> > >
>> > > On Fri, Apr 16, 2010 at 7:33 AM, Sergey Beryozkin <
>> sberyozkin@gmail.com>
>> > > wrote:
>> > > > Hi
>> > > > no, JSONP is not supported OTB. You'd need to write a custom
>> > > > MessageBodyWriter and Reader(if reading too).
>> > > > I'm not sure if Jackson supports it ? Jersey might support it OTB,
>> but
>> > > not
>> > > > sure
>> > > >
>> > > > cheers, Sergey
>> > > >
>> > > > On Thu, Apr 15, 2010 at 10:21 PM, Jason Chaffee <
>> jchaffee@ebates.com>
>> > > wrote:
>> > > >
>> > > >> Does CXF support a way to return JSONP?
>> > > >>
>> > > >>
>> > > >
>> > >
>> >
>>
>
>


-- 
Sergey Beryozkin

Application Integration Division of Talend <http://www.talend.com>
http://sberyozkin.blogspot.com

Re: JSON with padding with jaxrs

Posted by Josh Holtzman <jh...@berkeley.edu>.
Great, thanks for cleaning this up and writing the documentation Sergey.  It
looks great!

Josh

On Sun, Apr 10, 2011 at 9:56 AM, Sergey Beryozkin <sb...@gmail.com>wrote:

> Hi Josh
>
> I've decided to apply your patch, given that it can be handy for CXF users
> to just add few CXF interceptors and have it working across different
> deployment platforms, with/without Servlet filters be available. The
> interceptors are very simple,  but they are configurable, and may be
> something more sophisticated can be supported in time. Updated
> documentation
> is at [1] - if you have some ideas on how to improve those interceptors
> then
> let me know please
>
> thanks, Sergey
>
> [1]
>
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Data+Bindings#JAX-RSDataBindings-JSONWithPadding
>
> On Sun, Jan 16, 2011 at 6:33 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >wrote:
>
> > Hi Josh
> >
> > I've added some initial documentation about JSONP [1] where I included
> the
> > code fragment from [2] but also linked to your blog post.
> >
> > I think it may still make sense to apply your patch. CXF JAX-RS users
> would
> > probably appreciate if they could register JSONP CXF interceptors while
> > configuring a given endpoint from Spring. I'll look into the possibility
> of
> > applying the patch
> >
> >
> > thanks, Sergey
> >
> > [1]
> >
> https://cwiki.apache.org/confluence/display/CXF20DOC/JAX-RS+Data+Bindings#JAX-RSDataBindings-JSONWithPadding
> > [2] https://issues.apache.org/jira/browse/CXF-3005.
> >
> > On Sat, Jan 15, 2011 at 9:50 PM, Josh Holtzman <jholtzman@berkeley.edu
> >wrote:
> >
> >> I haven't implemented the improvements in the patch because I found it
> >> easier to actually add the padding via a servlet filter.  This way,
> >> regardless of what technology you use, CXF, Servlet, Jettison or
> Jackson,
> >> the filter can intercept the response and wrap it.  I wrote up a more
> >> thorough description at [1].
> >>
> >> Hope this helps,
> >> Josh
> >>
> >> [1] http://josh.media.berkeley.edu/?p=78
> >>
> >>
> >> On Sat, Jan 15, 2011 at 7:01 PM, Sergey Beryozkin <sberyozkin@gmail.com
> >> >wrote:
> >>
> >> > Hi
> >> >
> >> > On Fri, Jan 14, 2011 at 6:51 PM, James Carr <ja...@gmail.com>
> >> > wrote:
> >> >
> >> > > Not to resurrect old threads, but I'm curious if it has been
> enabled?
> >> > >
> >> >
> >> > Please see https://issues.apache.org/jira/browse/CXF-3005.
> >> > Josh H. has submitted a patch which I believe should work with
> >> JSONProvider
> >> > (Jettison), Jackson, etc.
> >> >
> >> > Dobes V. has commented on how to do it by extending the default
> >> > JSONProvider. I'll update the docs... Dobes, by the way, the
> >> JSONProvider
> >> > subclasses can do getContext().getHttpServletRequest(), where
> >> getContext()
> >> > returns a custom CXF MessageContext...
> >> >
> >> > Josh - I'll probably go ahead and commit a patch. I can update it to
> do
> >> an
> >> > extra check for application/javascript. I know you were thinking about
> >> > enhancing the patch but may be you can do it after I check in your
> >> current
> >> > one ?
> >> >
> >> > thanks, Sergey
> >> >
> >> > I know Jersey does support it with a little bit of work.
> >> > >
> >> > > Thanks,
> >> > > James
> >> > >
> >> > >
> >> > > On Fri, Apr 16, 2010 at 7:33 AM, Sergey Beryozkin <
> >> sberyozkin@gmail.com>
> >> > > wrote:
> >> > > > Hi
> >> > > > no, JSONP is not supported OTB. You'd need to write a custom
> >> > > > MessageBodyWriter and Reader(if reading too).
> >> > > > I'm not sure if Jackson supports it ? Jersey might support it OTB,
> >> but
> >> > > not
> >> > > > sure
> >> > > >
> >> > > > cheers, Sergey
> >> > > >
> >> > > > On Thu, Apr 15, 2010 at 10:21 PM, Jason Chaffee <
> >> jchaffee@ebates.com>
> >> > > wrote:
> >> > > >
> >> > > >> Does CXF support a way to return JSONP?
> >> > > >>
> >> > > >>
> >> > > >
> >> > >
> >> >
> >>
> >
> >
>
>
> --
> Sergey Beryozkin
>
> Application Integration Division of Talend <http://www.talend.com>
> http://sberyozkin.blogspot.com
>