cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <>
Subject c3 and JSON
Date Tue, 12 Apr 2011 10:19:08 GMT
Hi all,

as I mentioned in another mail I am ATM developing a prototype based on
c3. In another recent project we worked with jersey [1], which is the
reference implementation for JAX-RS (JSR 311).

Our c3 prototype will expose a couple of REST services and looking at
the c3 sources I have not found any references to return a JSONObject
like follows in our REST services. 

JSONObject object = JSONObject.fromObject(answerBean);
return object.toString();

where in c3 I do:

return new URLResponse("servlet:/controller/screen", data);

I looked at the URLResponse and on some other classes that implement
RestResponse. In my understanding I need to create a JsonResponse which
would do something like:

JSONObject object = JSONObject.fromObject(answerBean);
return new JsonResponse(object);

and in the JsonResponse
public class JsonResponse implements RestResponse{
  IOUtils.write(data.toString(), outputStream);

Well I did it and it worked very nicely. :)

I needed to add 
to my POM, though. 

Is this from general interest and should I commit the JsonResponse into
the package


Thorsten Scherler <>
codeBusters S.L. - web based systems
<consulting, training and solutions>

View raw message