Apache Cocoon 2.0.4 for Windows

What is Cocoon?

Apache Cocoon is an XML publishing framework that raises the usage of XML and XSLT technologies for server applications to a new level. Designed for performance and scalability around pipelined SAX processing, Cocoon offers a flexible environment based on a separation of concerns between content, logic, and style. To top this all off, Cocoon's centralized configuration system and sophisticated caching help you to create, deploy, and maintain rock-solid XML server applications.

Cocoon interacts with most data sources, including filesystems, RDBMS, LDAP, native XML databases, and network-based data sources. It adapts content delivery to the capabilities of different devices like HTML, WML, PDF, SVG, and RTF, to name just a few. You can run Cocoon as a Servlet as well as through a powerful, commandline interface. The deliberate design of its abstract environment gives you the freedom to extend its functionality to meet your special needs in a highly modular fashion.

Installation

  1. This example shows the latest version of the product (17th March 2003), but you may see the other version.
  2. Download Java Virtual Machine SDK (j2sdk-1_4_1_01-windows-i586.exe) from sun website and install it
  3. Download Apache/Tomact (jakarta-tomcat-4.1.18.exe) from The Jakarta Project (http://jakarta.apache.org/tomcat) and install it.
  4. Downlaad Apache/Cocoon (cocoon-2.0.4-vm14-bin.zip), extract and place cocoon.war into [../tomcat 4.1/webapps] directry.
  5. Open a browser and access "http://localhost:8080", you'll see "The Apache Jakarta Project, Tomcat" page and access "http://localhost:8080/cocoon/", you'll see "Cocoon" page. That's all done.

Create a web application

  1. Open $COCOON_HOME\sitemap.xmap and add pointer to your web application below pipeline
    <!-- ========================= Pipelines =============================== -->
     <map:pipelines>
    
      <map:pipeline>
        <map:match pattern="ba/**">
        <map:mount uri-prefix="ba"
          src="file:K:/doc/manual/ba/sitemap.xmap"
          check-reload="yes" />
        </map:match>
      </map:pipeline>
    
  2. Copy $COCOON_HOME\samples\sitemap.xmap into your web application directory and modify like below
    <?xml version="1.0"?>
    
    <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
    <!-- =========================== Components ================================ -->
    
     <map:components>
    
      <map:matchers default="wildcard"/>
      <map:selectors default="browser"/>
      <map:generators default="file"/>
      <map:transformers default="xslt"/>
      <map:readers default="resource"/>
      <map:serializers default="html"/>
    
     </map:components>
    
    <!-- =========================== Views =================================== -->
    
     <map:views>
      <map:view name="content" from-label="content">
       <map:serialize type="xml"/>
      </map:view>
    
      <map:view name="pretty-content" from-label="data">
        <map:transform src="common/style/xsl/html/simple-xml2html.xsl"/>
        <map:serialize type="html"/>
      </map:view>
      
      <map:view name="links" from-position="last">
       <map:serialize type="links"/>
      </map:view>
    
     </map:views>
    
    <!-- =========================== Pipelines ================================= -->
     <map:pipelines>
      <map:pipeline>
    
       <map:match pattern="">
        <map:redirect-to uri="index.html"/>
       </map:match>
     
       <map:match pattern="index.html">
         <map:generate src="index.xml"/>
         <map:transform src="style/indexhtml.xsl"/>
         <map:serialize/>
       </map:match>
    
       <map:match pattern="**.html">
         <map:generate src="{1}.xml"/>
         <map:transform src="style/html.xsl"/>
         <map:serialize/>
       </map:match>
    
       <map:match pattern="**.pdf">
         <map:generate src="{1}.xml"/>
         <map:transform src="style/pdf.xsl"/>
         <map:serialize type="fo2pdf"/>
       </map:match>
    
       <map:match pattern="**.xls">
         <map:generate src="{1}.xml"/>
         <map:transform src="style/simple-page2xls.xsl"/>
         <map:serialize type="fo2xls"/>
       </map:match>
    
       <map:match pattern="**.doc">
         <map:generate src="{1}.xml"/>
         <map:serialize type="fo2rtf"/>
       </map:match>
    
       <map:match pattern="**.css">
         <map:read mime-type="text/css" src="{1}.css"/>
       </map:match>
    
    
       <map:match pattern="**.htm">
         <map:generate type="file" src="{1}.htm"/>
         <map:serialize type="html"/>
       </map:match>
    
       <!-- ========================= Server ================================ -->
    
       <map:match pattern="**favicon.ico">
        <map:read src="common/resources/icons/cocoon.ico" mime-type="application/ico"/>
       </map:match>
       
       <!-- ================== Common ======================= -->
       <map:match pattern="*.css">
        <map:read src="common/style/css/{1}.css" mime-type="text/css"/>
       </map:match>
    
       <map:match pattern="images/*.gif">
        <map:read src="common/resources/images/{1}.gif" mime-type="image/gif"/>
       </map:match>
    
       <map:match pattern="images/*.jpg">
        <map:read src="common/resources/images/{1}.jpg" mime-type="image/jpg"/>
       </map:match>
    
       <map:match pattern="images/*.png">
        <map:read src="common/resources/images/{1}.png" mime-type="image/png"/>
       </map:match>
    
       <!-- samples automount -->  
       <map:match pattern="*/**">
         <map:mount uri-prefix="{1}" src="{1}/" check-reload="yes"/>
       </map:match>
    
       <map:handle-errors>
        <map:transform src="common/style/xsl/html/error2html.xsl"/>
        <map:serialize type="html" status-code="500"/>
       </map:handle-errors>
    
      </map:pipeline>
     </map:pipelines>
    
    </map:sitemap>
    
    <!-- end of file -->
    
    

Back - Support
Google
Web www.grape-info.com