cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <>
Subject Cocoon 3: REST
Date Tue, 13 Sep 2011 18:11:38 GMT

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?


Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email:
University of Oulu, Finland  | WWW:
StruBioCat                   | WWW:
NordProt                     | WWW:
Triacle Biocomputing         | WWW:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message