Hello. I've promised some (not so long) time ago to share my experiments with C3 and Spring, and now I am ready to show some interesting achievements.

Here is the source code:
https://github.com/igorzep/cocoon-springification

What it does...

1) Use traditional annotated Spring Controllers
I think it is better REST than Cocoon today. Those days when Cocoon was a leader in this respect has passed, and it really was the best REST framework from day one when nobody even used this word. But now Spring is really powerful and I think Cocoon should not try to invent own things but integrate with Spring as much as possible. In current form it "disables" Spring functionality and replace with own much more limited solution.

2) Use Cocoon Sitemap as Spring View
Again - traditional Spring way. Also i map Cocoon to WEB-INF so that sitemap is hidden for direct browser access (good trick to workaround lack of private pipelines in C3).

3) Use Spring FORM tag library in SAX pipeline
When it is very simple implementation it works quite good already, much better than I expect from it myself...

4) Integrated Validation with Spring and Hibernate Validator
Again - traditional Spring 3 way of handling forms, together with previous item can be a good foundation for replacing old Cocoon forms module...

5) EclipseLink JPA
Just my favorite, as it implements both JPA and JAXB...

6) Mapping Spring model to XML with JAXB annotations
Just a quick hack as everything else...

7) JRebel compatible, just generate rebel.xml for "main" module
Unfortunately EclipseLink JRebel plugin does not work with latest EclipseLink, but can be switched off easily. Otherwise I did a small fix to XSLT transformer, so it rechecks for modifications correctly (not included with sources) and it works much better than Cocoon RCL. Actually Cocoon RCL destroyed root spring context on first invocation and any future requests to EclipseLink didn't work at all.

I think that Cocoon RCL should be dropped at all - it is unusable for something serious, if you do something more than totally trivial it takes more time to fight with it, works almost always incorrectly and saves no time as the result...


Thanks.
Discussions and critics are welcome.

Reply via email to