cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reinhard Poetz <>
Subject RESTapples
Date Fri, 16 Mar 2007 07:12:42 GMT
Daniel Fagerstrom wrote:
> Spring actions
> ==============
> With AJAX it is much easier to have a stateless web server as backend. 
> But Cocoon's "recommended" controllers: Flowscripts and Javaflow main 
> focus is on session based servers. And Cocoon actions isn't exactly the 
> most exciting technology around.
> I'd like actions that embrace dependency injection, doesn't need to 
> implement some obscure interface and that can be easily used with a 
> reloading classloader. IMO the action part of Struts2 
> ( has a lot of 
> god ideas. Either we could try to make it possible to use the Struts2 
> action framework as Cocoon actions or steal some of their ideas.
> ====
> Gianugo has evangelized using Cocoon as a REST framework (couldn't find 
> any link though). Steve Loughran says that the Cocoon folk has a better 
> idea about what to do in the REST area than the WS projects: 
> That is soomething to live up to ;)
> Cocoon already have a lot of what is needed but lacks e.g. a mechanism 
> for content negotiation and ETags support and more work is needed on 
> return codes. What especially is lacking is REST samples and a tutorial 
> on how to use Cocoon as a REST web service server.

I've been working on rest block that is based on Apples. It won't do much but to 
provide a controller interface that extends the StatelessApplesController

public interface RestApple extends StatelessAppleController {

     void doGet(AppleRequest req, AppleResponse res) throws Exception;

     void doPost(AppleRequest req, AppleResponse res) throws Exception;

     void doPut(AppleRequest req, AppleResponse res) throws Exception;

     void doDelete(AppleRequest req, AppleResponse res) throws Exception;


and provides an abstract implementation. Based on the method of the incoming 
http request, one of the 4 methods is invoked. Currently this switch is 
implemented in the AbstractRestApple but should be moved to the Apples processor.

If we worked on the Apples processor, we could even drop the requirement of 
implementing an interface and do the same like Struts 2.
But I wonder what we gain except from being more modern, if we used annotations 
(actually it doesn't bring much because you still have to add an import 
statement for the annotation) or a reflection mechanism to determine which 
method to execute ;-)

Reinhard Pötz           Independent Consultant, Trainer & (IT)-Coach 

{Software Engineering, Open Source, Web Applications, Apache Cocoon}


Telefonate ohne weitere Kosten vom PC zum PC:

View raw message