Hi,

It appears that there are basically two ways of implementing a REST service with cocoon3. There is the RESTController way and there is the JAX-RS way. I have tried the latter. If a resource (e.g PersonResource) is requested, I create a response that uses the string-template generator to produce an initial XML with person data (like name, etc), followed by a transformer that converts it to JSON file (the JSON is basically wrapped inside a single element), followed by a JSONSerializer (which validates the JSON text) to generate the actual response that is send back to the client (as application/json). This works just perfectly. See a previous email [1] with regard to the JSonSerializer (any comments?).

I am bit wondering why there are two ways of doing REST. The RESTController looks very much the same as the JAX-RS based resource. With the controller, I would call the same pipeline (using URLResponseBuilder) as explained above. The RESTController looks slightly different, but otherwise does the same thing.

So, what exactly was the reason to have both a RESTController and JAX-RS-way of approach? Is there a preferred way. Should I assume that the RESTController would become the preferred way of implementing REST?

[1] http://www.mail-archive.com/users@cocoon.apache.org/msg46270.html

--
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juf...@oulu.fi
University of Oulu, Finland  | WWW: www.biochem.oulu.fi/Biocomputing/
StruBioCat                   | WWW: www.strubiocat.oulu.fi
NordProt                     | WWW: www.nordprot.org
Triacle Biocomputing         | WWW: www.triacle-bc.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to