Re: REST and JSON plugins
It should be easy to plug in a new serializer (only JSONUtil needs to be changed I think). If you have suggestions on how to improve the current serializer, let me know, or even better, a patch ;) musachy On Mon, Jul 14, 2008 at 11:05 AM, Marc Logemann <[EMAIL PROTECTED]> wrote: > +1 for a pluggable serializer. I dont like the internal json plugin > serializer that much and yes, the plugin should be included in the > distro because json is that popular these days > > -- > Marc Logemann > blog http://logemannreloaded.blogspot.com > privat http://www.logemann.org > > > > Am 14.07.2008 um 15:42 schrieb Musachy Barroso: > >> The original idea behind the JSON plugin was to use an external >> library to serialize the objects, xstream to be more specific. But >> xstream json wasn't even usable at that point and json-lib didn't look >> that good to me. I think Struts 2 should include a json plugin, and >> yes we could delegate the serialization to json-lib, or xstream. >> >> musachy >> >> On Mon, Jul 14, 2008 at 4:07 AM, Jeromy Evans >> <[EMAIL PROTECTED]> wrote: >>> >>> Oleg Mikheev wrote: >>>> >>>> Hi! >>>> >>>> Will REST plugin replace JSON plugin in Struts 2.1? >>>> To my mind JSON plugin was very REST-like, and I was >>>> really hoping that it would evolve into something that >>>> REST plugin claims to be. >>>> >>>> Also, do REST and JSON plugins have anything in common? >>> >>> They're not related except both can serialize an action/model into JSON. >>> >>> In the past I created a ContentTypeHandler for the REST Plugin that used >>> the >>> JSON plugin's serializer. The result was exactly the same. >>> >>> The REST plugin uses json-lib for its default JSON ContentTypeHandler. >>> (http://json-lib.sourceforge.net/) >>> The advantage of JSON-lib is that it's bidirectional (essential for the >>> plugin) and is used in many frameworks. >>> The advantage of the JSON-plugin is that it includes some simple options >>> to >>> customize the output specifically for S2 (such as changing the root >>> object). >>> >>> I've contributed to both the JSON plugin and REST plugin and use the JSON >>> plugin when I'm writing plain actions that return JSON responses and >>> json-lib when using the REST plugin. The options the JSON-plugin >>> provides >>> are generally not relevant when using the REST plugin so it's not >>> valuable >>> to run both. >>> >>> The JSON plugin should probably be updated to allow the serializer to be >>> customized so you can use the json-lib serializer or the native >>> serializer. >>> >>>> After I read REST plugin author's Struts 2 in Action >>>> book it seemed that he wasn't aware of JSON plugin at >>>> all - he devoted several pages to implementation of a >>>> custom JSON handlers instead of just dropping JSON >>>> plugin into Struts 2 stack.. >>>> >>> >>> I presume that's just because the JSON plugin isn't part of the Struts 2 >>> distribution per se. >>> >>> >>> >>> - >>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>> For additional commands, e-mail: [EMAIL PROTECTED] >>> >>> >> >> >> >> -- >> "Hey you! Would you help me to carry the stone?" Pink Floyd >> >> - >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REST and JSON plugins
+1 for a pluggable serializer. I dont like the internal json plugin serializer that much and yes, the plugin should be included in the distro because json is that popular these days -- Marc Logemann blog http://logemannreloaded.blogspot.com privat http://www.logemann.org Am 14.07.2008 um 15:42 schrieb Musachy Barroso: The original idea behind the JSON plugin was to use an external library to serialize the objects, xstream to be more specific. But xstream json wasn't even usable at that point and json-lib didn't look that good to me. I think Struts 2 should include a json plugin, and yes we could delegate the serialization to json-lib, or xstream. musachy On Mon, Jul 14, 2008 at 4:07 AM, Jeromy Evans <[EMAIL PROTECTED]> wrote: Oleg Mikheev wrote: Hi! Will REST plugin replace JSON plugin in Struts 2.1? To my mind JSON plugin was very REST-like, and I was really hoping that it would evolve into something that REST plugin claims to be. Also, do REST and JSON plugins have anything in common? They're not related except both can serialize an action/model into JSON. In the past I created a ContentTypeHandler for the REST Plugin that used the JSON plugin's serializer. The result was exactly the same. The REST plugin uses json-lib for its default JSON ContentTypeHandler. (http://json-lib.sourceforge.net/) The advantage of JSON-lib is that it's bidirectional (essential for the plugin) and is used in many frameworks. The advantage of the JSON-plugin is that it includes some simple options to customize the output specifically for S2 (such as changing the root object). I've contributed to both the JSON plugin and REST plugin and use the JSON plugin when I'm writing plain actions that return JSON responses and json-lib when using the REST plugin. The options the JSON-plugin provides are generally not relevant when using the REST plugin so it's not valuable to run both. The JSON plugin should probably be updated to allow the serializer to be customized so you can use the json-lib serializer or the native serializer. After I read REST plugin author's Struts 2 in Action book it seemed that he wasn't aware of JSON plugin at all - he devoted several pages to implementation of a custom JSON handlers instead of just dropping JSON plugin into Struts 2 stack.. I presume that's just because the JSON plugin isn't part of the Struts 2 distribution per se. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REST and JSON plugins
The original idea behind the JSON plugin was to use an external library to serialize the objects, xstream to be more specific. But xstream json wasn't even usable at that point and json-lib didn't look that good to me. I think Struts 2 should include a json plugin, and yes we could delegate the serialization to json-lib, or xstream. musachy On Mon, Jul 14, 2008 at 4:07 AM, Jeromy Evans <[EMAIL PROTECTED]> wrote: > Oleg Mikheev wrote: >> >> Hi! >> >> Will REST plugin replace JSON plugin in Struts 2.1? >> To my mind JSON plugin was very REST-like, and I was >> really hoping that it would evolve into something that >> REST plugin claims to be. >> >> Also, do REST and JSON plugins have anything in common? > > They're not related except both can serialize an action/model into JSON. > > In the past I created a ContentTypeHandler for the REST Plugin that used the > JSON plugin's serializer. The result was exactly the same. > > The REST plugin uses json-lib for its default JSON ContentTypeHandler. > (http://json-lib.sourceforge.net/) > The advantage of JSON-lib is that it's bidirectional (essential for the > plugin) and is used in many frameworks. > The advantage of the JSON-plugin is that it includes some simple options to > customize the output specifically for S2 (such as changing the root object). > > I've contributed to both the JSON plugin and REST plugin and use the JSON > plugin when I'm writing plain actions that return JSON responses and > json-lib when using the REST plugin. The options the JSON-plugin provides > are generally not relevant when using the REST plugin so it's not valuable > to run both. > > The JSON plugin should probably be updated to allow the serializer to be > customized so you can use the json-lib serializer or the native serializer. > >> After I read REST plugin author's Struts 2 in Action >> book it seemed that he wasn't aware of JSON plugin at >> all - he devoted several pages to implementation of a >> custom JSON handlers instead of just dropping JSON >> plugin into Struts 2 stack.. >> > > I presume that's just because the JSON plugin isn't part of the Struts 2 > distribution per se. > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: REST and JSON plugins
Oleg Mikheev wrote: Hi! Will REST plugin replace JSON plugin in Struts 2.1? To my mind JSON plugin was very REST-like, and I was really hoping that it would evolve into something that REST plugin claims to be. Also, do REST and JSON plugins have anything in common? They're not related except both can serialize an action/model into JSON. In the past I created a ContentTypeHandler for the REST Plugin that used the JSON plugin's serializer. The result was exactly the same. The REST plugin uses json-lib for its default JSON ContentTypeHandler. (http://json-lib.sourceforge.net/) The advantage of JSON-lib is that it's bidirectional (essential for the plugin) and is used in many frameworks. The advantage of the JSON-plugin is that it includes some simple options to customize the output specifically for S2 (such as changing the root object). I've contributed to both the JSON plugin and REST plugin and use the JSON plugin when I'm writing plain actions that return JSON responses and json-lib when using the REST plugin. The options the JSON-plugin provides are generally not relevant when using the REST plugin so it's not valuable to run both. The JSON plugin should probably be updated to allow the serializer to be customized so you can use the json-lib serializer or the native serializer. After I read REST plugin author's Struts 2 in Action book it seemed that he wasn't aware of JSON plugin at all - he devoted several pages to implementation of a custom JSON handlers instead of just dropping JSON plugin into Struts 2 stack.. I presume that's just because the JSON plugin isn't part of the Struts 2 distribution per se. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
REST and JSON plugins
Hi! Will REST plugin replace JSON plugin in Struts 2.1? To my mind JSON plugin was very REST-like, and I was really hoping that it would evolve into something that REST plugin claims to be. Also, do REST and JSON plugins have anything in common? After I read REST plugin author's Struts 2 in Action book it seemed that he wasn't aware of JSON plugin at all - he devoted several pages to implementation of a custom JSON handlers instead of just dropping JSON plugin into Struts 2 stack.. Oleg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]