cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andre Juffer <ajuf...@cc.oulu.fi>
Subject Cocoon3, JSON, Spring
Date Thu, 01 Sep 2011 19:30:59 GMT
Hi All,

I have two questions:

(1)
I want to be to be able to return JSON to the client, typically a 
browser. The client is responsible to properly present the response to 
the user, typically with the Dojotoolkit. As I would like to move to 
cocoon3, I was looking for a JsonSerializer or a simple TextSerializer.

With cocoon 2.2, one can simply use the TextSerializer to return JSON, 
by defining

<map:serializer name="json" mime-type="application/json; charset=UTF-8"
                 src="org.apache.cocoon.serialization.TextSerializer">
   <encoding>UTF-8</encoding>
</map:serializer>

Cocoon 3 apparently is restricted to only return XML/HTML [1], as far as 
I can see. I did not find in the API any mentioning of other types of 
serializers, besides XMLSerializer and FopSerializer.

If so, this would be a limitation. Especially for designing RIAs [2] 
(like Twitter), it would be very useful to be able to return JSON.

So, is there a particular way to return JSON or Text.


(2)
With flowscript in cocoon 2.2, it was very easy to instantiate a Java 
bean defined in some appropriate Spring bean configuration file, like

var someFacade = cocoon.getComponent("someFacade");
someFacade.doSomething(...);

Is there a recommended way in Cocoon 3 to instantiate beans. One could do

ApplicationContext context =
   new ClassPathXmlApplicationContext( new String[] 
{"beans-spring.cfg.xml");
SomeFacade facade = (SomeFacade)context.getBean("someFacade");
facade.doSomething(...);

within a JAX-RS resource [3].

So, is this way to do instantiate beans?

Thanks,
Andre


[1] http://cocoon.apache.org/3.0/features.html
[2] http://en.wikipedia.org/wiki/Rich_Internet_application
[3] http://cocoon.apache.org/3.0/referenc/html/webapps.html#webapps.rest

-- 
Andre H. Juffer              | Phone: +358-8-553 1161
Biocenter Oulu and           | Fax: +358-8-553-1141
Department of Biochemistry   | Email: andre.juffer@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-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message