struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeromy Evans <jeromy.ev...@blueskyminds.com.au>
Subject Re: REST and JSON plugins
Date Mon, 14 Jul 2008 08:07:44 GMT
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message