cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giacomo Pati <Giacomo.P...@pwr.ch>
Subject Re: Misstype
Date Sun, 19 Mar 2000 19:05:58 GMT
Hi donald

Donald Ball wrote:
> 
> Technically, I think I win that for finding, and patching, problems with
> cocoon2's build.xml file. Then again, that's wasn't _real_ bug in _real_
> surce code...so way to go, Giacomo! Now, since Pier hasn't elucidated

That's why I called it a "mistype" (don't know if this is real english)

> further on how to properly configure apache to work with cocoon2, can you
> post your configuration? Pier had said that it wasn't proper to simply map
> .xml files to the cocoon servlet...

Yes, there is no more "ApjServAction .xml
/servlet/org.apache.cocoon.Cocoon" directive

Actually I couldn't compile the cvs version because it didn't found some
method in the org.w3c.dom tree
Specially the files DOMStreamer.java, DOMBuilder.java and
ImageSerializer.java are the problem (could anybody tell me where to get
the right jars to compile them? I've used xerces from the cvs but the
methods requested aren't in it). If you kick those files out of the src
dir it compiles without complains.

To configure apache take a native jserv installation and do the
following:
   In jserv.properties:
      - put xerces.jar and xalan.jar in the wrapper.classpath=... 
   In zone.properties:
      - add a line:
repositories=/path/to/cocoon2/bin/cocoon-2.0-alpha1.jar
      - in the "Servlet Alias" section put 
          servlet.Cocoon2.code=org.apache.cocoon.servlet.CocoonServlet
      - in the "Aliased Servlet Init Parameters" section put
         
servlet.Cocoon2.initArgs=configurationFile=/path/to/cocoon2/configuration.xml
   I've copied the samples directory from the cocoon 1.x cvs to the
/path/to/cocoon2 
   directory to have some test files.

My configuration.xml look like this:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cut here >>>>>>>>>>>>>>>>>>>>>>>>>>>
<?xml version="1.0"?>

<cocoon version="2.0">
  <component  role="parser"
class="org.apache.cocoon.components.parser.XercesParser"/>

  <generator  name="file"     
class="org.apache.cocoon.generators.FileGenerator"/>
  <generator  name="request"  
class="org.apache.cocoon.generators.RequestGenerator"/>
  <generator  name="directory"
class="org.apache.cocoon.generators.DirectoryGenerator"/>
  <generator  name="composer" 
class="org.apache.cocoon.generators.ComposerGenerator"/>
  <filter     name="xslt"     
class="org.apache.cocoon.filters.XalanFilter"/>
  <filter     name="sql"      
class="org.apache.cocoon.filters.SQLFilter"/>
  <serializer name="xml"      
class="org.apache.cocoon.serializers.XMLSerializer"/>
  <serializer name="html"     
class="org.apache.cocoon.serializers.HTMLSerializer"/>
<!--
  doesn't work becaus I couldn't compile the DOMBuilder, DOMStreamer
calsses on which
  the ImageSerializer is build on
  <serializer name="image"    
class="org.apache.cocoon.serializers.ImageSerializer"/>
-->
  
  <sitemap>
    <partition>
      <process uri="**.xml" source="**.xml">
        <generator name="file"/>
        <filter name="xslt">
          <parameter name="stylesheet"
value="samples/hello/hello-page-html.xsl"/>
        </filter>
        <serializer name="html">
          <parameter name="contentType" value="text/html"/>
        </serializer>
      </process>

      <process uri="**/" source="**/">
        <generator name="directory"/>
        <filter name="xslt">
          <parameter name="stylesheet"
value="samples/styles/directory-html.xsl"/>
        </filter>
        <serializer name="html">
          <parameter name="contentType" value="text/html"/>
        </serializer>
      </process>
    </partition>
  </sitemap>
</cocoon>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cut here >>>>>>>>>>>>>>>>>>>>>>>>>>>

To transform directory listings to html put the following stylesheet in
/path/to/cocoon2/samples/styles as directory-html.xsl (see above in the
cofiguration.xml file

<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cut here >>>>>>>>>>>>>>>>>>>>>>>>>>>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                             
xmlns:dir="http://xml.apache.org/cocoon/2.0/DirectoryGenerator">

  <xsl:template match="/dir:directory">
   <html>
    <head>
     <title><xsl:value-of select="@name"/></title>
    </head>
    <body bgcolor="#ffffff">
     <h1>Directory Listing <xsl:value-of select="@name"/></h1>
     <table border="0">
      <tr>
       <td><a href="../"><i>parent directory</i></a></td>
      </tr>
      <xsl:apply-templates/>
     </table>
    </body>
   </html>
  </xsl:template>

  <xsl:template match="dir:directory">
   <tr>
    <td>
     <a>
      <xsl:attribute name="href"><xsl:value-of
select="@name"/></xsl:attribute>
      <i><xsl:apply-templates/></i>
     </a>
    </td>
   </tr>
  </xsl:template>

  <xsl:template match="dir:file">
   <tr>
    <td>
     <a>
      <xsl:attribute name="href"><xsl:value-of
select="@name"/></xsl:attribute>
      <xsl:apply-templates/>
     </a>
    </td>
   </tr>
  </xsl:template>

</xsl:stylesheet>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cut here >>>>>>>>>>>>>>>>>>>>>>>>>>>

Restart Apache and enter: http://localhost/servlets/Cocoon2/samples/

This should show you a simple directory listing of the samples
directory. You can klick on hello and get a listing of two files. Klick
on hello-page.xml an you shouöld get the normal output as with cocoon
1.x.

Hope this works for you, too! Good luck!

Giacomo

-- 
PWR Organisation & Entwicklung            Tel:   +41 (0)1 856 2202
Giacomo Pati                              Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Mime
View raw message