You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/08/14 09:36:40 UTC

svn commit: r685790 - in /cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt: features.apt index.apt

Author: reinhard
Date: Thu Aug 14 00:36:40 2008
New Revision: 685790

URL: http://svn.apache.org/viewvc?rev=685790&view=rev
Log:
. add a pipeline example to the index page
. improve examples of the features page

Modified:
    cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/features.apt
    cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/index.apt

Modified: cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/features.apt
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/features.apt?rev=685790&r1=685789&r2=685790&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/features.apt (original)
+++ cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/features.apt Thu Aug 14 00:36:40 2008
@@ -7,7 +7,7 @@
 
 Features
 
-    Cocoon 3 consists of 3 layers:
+    Cocoon 3 consists of 3 layers. Each of this layers is packaged as separate module:
     
     * cocoon-pipeline
     
@@ -15,9 +15,19 @@
     
     * 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 3 implementations:
+    This module doesn't have any third-party dependencies. Currently it provides three pipeline implementations:
     
     * noncaching
     
@@ -27,7 +37,7 @@
     
     []
     
-    It provides a basic set of SAX components:
+    and it provides a basic set of SAX components:
 
     * FileGenerator
     
@@ -41,6 +51,8 @@
     
     * FileReader
     
+    * StringGenerator
+    
     []
     
     Here is an example:
@@ -58,7 +70,7 @@
     
 Cocoon Sitemap
 
-    A sitemap connects a request (not necessarily a servlet request) with a pipeline. Here is an example:
+  A sitemap connects a request (not necessarily a servlet request!) with a pipeline. Here is an example:
 
 +------------------------------------------+  
 <?xml version="1.0" encoding="UTF-8"?>
@@ -66,8 +78,8 @@
   xmlns:servlet="http://apache.org/cocoon/corona/servlet">
   <map:pipelines>
     <map:pipeline>
-      <map:match pattern="videos/{id}">
-        <map:generate src="video/{map:id}.xml" type="file" />
+      <map:match pattern="screen/video">
+        <map:generate src="video.xml" type="stringtemplate" />
         <map:serialize type="xml" />
       </map:match>
     </map:pipeline>
@@ -77,4 +89,58 @@
     
 Cocoon Servlet
 
-    This module provides a servlet that connects an HTTP request with a sitemap. 
+    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 <inter-sitemap> 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 <cocoon-stringtemplate>, <cocoon-controller>, and <cocoon-rest> make the development of
+RESTful webservices simple. Here is the sitemap that invokes a controller:
+
++------------------------------------------+
+<?xml version="1.0" encoding="UTF-8"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/corona/sitemap"
+  xmlns:servlet="http://apache.org/cocoon/corona/servlet"
+  xmlns:controller="http://apache.org/cocoon/corona/controller">
+  <map:pipelines>
+    <map:pipeline>
+      <map:match pattern="videos/{id}">
+        <controller:call controller="rest-controller" select="VideoController">
+          <map:parameter name="id" value="{map:id}" />
+        </controller:call>
+      </map:match>
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>
++------------------------------------------+
+
+And here the controller:
+
++------------------------------------------+
+@RESTController
+public class VideoController implements Get {
+
+    @SitemapParameter
+    private String id;
+
+    @RequestParameter
+    private String details;
+
+    public RestResponse doGet() throws Exception {
+        Map<String, Object> data = new HashMap<String, Object>();
+        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 <<<id>>> and the request parameter <<<details>>> 
+are passed to the controller. 
+
+  The controller implements the <<<Get>>> interface which makes it reacting on GET requests. Then the controller invokes
+the pipeline <<<servlet:/screen/video>>> (see the sitemap in the section above) which uses {{{http://www.stringtemplate.org/}StringTemplate}} to render
+the <Video> object to XML.

Modified: cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/index.apt?rev=685790&r1=685789&r2=685790&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/index.apt (original)
+++ cocoon/whiteboard/corona/trunk/corona-docs/src/site/apt/index.apt Thu Aug 14 00:36:40 2008
@@ -5,14 +5,32 @@
  2008
  -----
 
-Cocoon 3 Documentation
+Apache Cocoon 3
 
-  Cocoon 3 is a major rewrite of Apache Cocoon. Like Cocoon 2 it is based around the concept of 
-pipelines and sitemaps but is slimed down and designed to be easily usable from within 
-plain Java environments. On top of this Cocoon 3 has the goal of becoming the best available 
-platform for RESTful webservices and web applications.
+  Apache Cocoon 3 is a major rewrite of Cocoon 2.2. Like Cocoon 2 it is based around the concept of 
+pipelines and sitemaps and it is very similar to Cocoon 2.2 in many respects but is slimed down and 
+designed to be <<easily usable from within plain Java environments>>. On top of this Cocoon 3 has the goal 
+of becoming the best available platform for <<RESTful webservices>> and web applications.
 
-News
+* Using Pipelines in Java has never been so easy
 
-    * <<2008-08-09>> Corona {{{http://cocoon.markmail.org/message/txav36lmvpkpbso4}was accepted}} 
-      by the Cocoon PMC to become Cocoon 3.
+  Here is an example that transforms an XML String by using two stylesheets:
+
++------------------------------------------+
+Pipeline pipeline = new NonCachingPipeline();
+pipeline.addComponent(new StringGenerator("<x></x>"));
+pipeline.addComponent(new XSLTTransformer(PipelineTest.class.getClassLoader().getResource("test1.xslt")));
+pipeline.addComponent(new XSLTTransformer(PipelineTest.class.getClassLoader().getResource("test2.xslt")));
+pipeline.addComponent(new XMLSerializer());
+
+ByteArrayOutputStream baos = new ByteArrayOutputStream();
+pipeline.setup(null, baos);
+pipeline.execute();
++------------------------------------------+     
+
+  The idea behind using a pipeline for this purpose is that the content of the pipeline (in this case SAX events) 
+is streamed without any necessary serialization or deserialization steps <between> the components.
+
+* Sitemaps and integration with Java Servlets
+
+  But there is more that Cocoon 3 offers. See our {{{features.html} features}} list.