Cocoon
Apache’s Cocoon framework was developed as part of a project to provide online documentation for the Apache Software Foundation’s Java libraries. Owing to this history, Cocoon’s page generation is built around the concept of a “pipeline,” where data, encoded as an XML document, passes through several transformations (which can be described using Java or XSLT) before it is presented to the user as HTML, XML, or another format. Cocoon makes heavy use of XML languages and XSLT in definining pipelines, templates, forms, and even as a preprocessor that generates Java. One of Cocoon’s unique features among Java frameworks is its support for continuation-based web programming. Cocoon allows deveopers to write controller logic in JavaScript, which it interprets with an embedded version of the Mozilla Foundation’s Rhino JavaScript interpreter. Cocoon’s Flowscript JavaScript API provides a
sendPageAndWait
method that is analagous to the PLT server’s send/suspend
. Though the JavaScript code has full access to Java classes and objects, Cocoon is limited by the inability to capture a continuation from Java. Once a JavaScript controller calls sendPageAndWait
to invoke a pipeline to generate a page, the web application cannot capture any continuations until the user responds to the page and control passes back into JavaScript. Since the view elements of Cocoon — the pipelines — cannot dynamically create continuations to tie to links, Cocoon has no analogue to the PLT server’s send/suspend/dispatch
.Highlights
- Pipeline model of handling requests, based around XML transformation
- Combines XSLT and Java as a preprocessor: Logic files use XSLT to pattern match on input XML and generate Java code
- Has a “view” mechanism for accessing content orthoginal to a normal pipeline
- Built-in and configurable support for automatically caching steps of a pipeline
- Overall application layout and pipelines specified externally in an XML file
- Contains a JavaScript interpreter with continuation and sendPageAndWait (send/suspend) support that can invoke pipelines and also call back into Java
- Form definitions written in XML, rather than Java
- Two-step form creation: widget -> XML, XML -> HTML (via XSLT)
- Pipeline itself does not support continuations
- Forms support still under development
- “Pipelines” are basically just functional programming. But that’s a big deal in Java, I guess.
Fun Excerpts from the Docmentation
- “In getting started with Cocoon, one must learn not only a number of concepts, but a number of details as well.”
- “Given the amount of hype, you can't afford to go around ignoring XML”
0 Comments:
Post a Comment
<< Home