-----
Features
-----
-----
2008
-----
Features
Cocoon 3 consists of 3 layers. Each of this layers is packaged as separate module:
* cocoon-pipeline
* cocoon-sitemap
* cocoon-servlet
[]
Additionally there are more optional modules:
* cocoon-stringtemplate
* cocoon-controller
* cocoon-rest
Cocoon Pipeline
This module doesn't have any third-party dependencies. Currently it provides three pipeline implementations:
* noncaching
* caching
* async-caching
[]
and it provides a basic set of SAX components:
* FileGenerator
* XSLTTransformer
* XMLSerializer
* IncludeTransformer
* CleaningTransformer
* FileReader
* StringGenerator
[]
Here is an example:
+------------------------------------------+
Pipeline pipeline = new NonCachingPipeline();
pipeline.addComponent(new StringGenerator(""));
pipeline.addComponent(new XSLTTransformer(PipelineTest.class.getClassLoader().getResource("test.xslt")));
pipeline.addComponent(new XMLSerializer());
ByteArrayOutputStream baos = new ByteArrayOutputStream();
pipeline.setup(null, baos);
pipeline.execute();
+------------------------------------------+
Cocoon Sitemap
A sitemap connects a request (not necessarily a servlet request!) with a pipeline. Here is an example:
+------------------------------------------+
+------------------------------------------+
Cocoon Servlet
This module provides a servlet that connects an HTTP request with a sitemap. It works
smoothly within the {{{http://cocoon.apache.org/subprojects/servlet-service/1.1/servlet-service-impl/1.1/1412_1_1.html}Servlet-Service framework}}.
The Servlet-Service framework enables the communication and provides polomorphistic features (e.g. one sitemap
can extend another one which allows e.g. the implementation of fallback solutions).
Additional Modules
The additional modules , , and make the development of
RESTful webservices simple. Here is the sitemap that invokes a controller:
+------------------------------------------+
+------------------------------------------+
And here the controller:
+------------------------------------------+
@RESTController
public class VideoController implements Get {
@SitemapParameter
private String id;
@RequestParameter
private String details;
public RestResponse doGet() throws Exception {
Map data = new HashMap();
data.put("video", new Video(this.id));
data.put("details", this.details);
return new Page("servlet:/screen/video", data);
}
}
+------------------------------------------+
When this annotated controller class is being executed, the sitemap parameter <<>> and the request parameter <<>>
are passed to the controller.
The controller implements the <<>> interface which makes it reacting on GET requests. Then the controller invokes
the pipeline <<>> (see the sitemap in the section above) which uses {{{http://www.stringtemplate.org/}StringTemplate}} to render
the