cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [DAISY] Updated: Modularize Cocoon apps (Using blocks)
Date Mon, 28 May 2007 16:03:44 GMT
A document has been updated:

Document ID: 1291
Branch: main
Language: default
Name: Modularize Cocoon apps (Using blocks) (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 5/28/07 4:03:41 PM
Updated by: Reinhard Pötz

A new version has been created, state: draft


This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 5391 bytes (previous version: 3763 bytes)
Content diff:
(50 equal lines skipped)
    <p>in order to make it ready for be imported in Eclipse and to put it into the
    local Maven repository. Then you can import the project into Eclipse.</p>
--- <h1>Connect block2 with block1</h1>
+++ <h1>Connect two blocks</h1>
    <p>Let's assume that you want to use a pipeline defined in <tt>block2</tt>
    within <tt>block1</tt>. You have to establish the connection between the two
(11 equal lines skipped)
      &lt;bean id="com.mycompany.myBlock1.block" class="org.apache.cocoon.sitemap.SitemapServlet"&gt;
        &lt;servlet:context mount-path="/myBlock1" context-path="blockcontext:/myBlock1/"&gt;
    <strong>      &lt;servlet:connections&gt;
---         &lt;entry key="block2" value-ref="com.mycompany.myBlock2.block"/&gt;
+++         &lt;entry key="myBlock2" value-ref="com.mycompany.myBlock2.block"/&gt;
(27 equal lines skipped)
--- %exclude-lib=com.mycompany:myBlock2</strong>
+++ %exclude-lib=com.mycompany:myBlock2
+++ </strong></pre>
+++ <p>Restart the servlet container by invoking</p>
+++ <pre>mvn jetty:run 
+++ <p>Now it's time to test connection. For that purpose add a pipeline to the
+++ sitemap of block1
+++ (<tt>getting-started-app/myBlock1/src/main/resources/COB-INF/sitemap.xmap</tt>):
+++ </p>
+++ <pre>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
+++ &lt;map:sitemap xmlns:map=""&gt;
+++   &lt;map:pipelines&gt;
+++     [...]
+++     &lt;map:pipeline&gt;
+++       &lt;map:match pattern="callingBlock2"&gt;
+++         &lt;map:generate src="<strong>servlet:myBlock2:/spring-bean</strong>"
+++         &lt;map:serialize type="xml"/&gt;
+++       &lt;/map:match&gt;
+++     &lt;/map:pipeline&gt;
+++     [...]
+++   &lt;/map:pipelines&gt;
+++ &lt;/map:sitemap&gt;
+++ </pre>
+++ <p>The file generator of this pipeline uses a special purpose protocol, the
+++ servlet protocol, to access a pipeline defined in the other block. If you enter
+++ <tt>http://localhost:8888/myBlock1/callingBlock2</tt> shows the output of
+++ spring-bean pipeline of <tt>myBlock2</tt> but routed through <tt>myBlock1</tt>.
+++ <br/>
+++ Though this is a "<em>hello word</em>" style example you might already imagine
+++ the power of this protocol, e.g. you can move all styling resources and
+++ pipelines to a particular block.</p>
    <h1>Use a pipeline fragment</h1>
--- <p class="fixme">TBD</p>
+++ <p>The previous example showed how you can call a pipeline from another block.
+++ But here is even more you can do! A sitemap can also provide pipeline fragements
+++ that can be used by other blocks.<br/>
+++ Add this pipeline to <tt>myblock2</tt>. It provides a transformation service
+++ that consists of two XSLT transformation steps:</p>
+++ <pre>TBD</pre>
+++ <p>Now it can be used from myBlock1</p>
+++ <pre>TBD</pre>
+++ <p>...</p>

View raw message