cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hugh Sparks" <>
Subject Cocoon 2.2 - Block name required in file path?
Date Wed, 10 Oct 2007 08:43:16 GMT
This is a 2.1 to 2.2 migration issue.

I created a simple c2 block using:

 mvn archetype:create \
                -DarchetypeGroupId=org.apache.cocoon \
                -DarchetypeArtifactId=cocoon-22-archetype-block \
                -DarchetypeVersion=1.0.0-RC3-SNAPSHOT \

Then I modified it to do an example I have working in
cocoon 2.1: a simple application that displays a
randomly selected quotation and image.

The quotations work as expected, but the path to the
images in the result.jx template (shown below) requires
the name of my block in the path:

        <img src="AAQuotes/${imageNumber}.gif"/>

I ported this example from a working cocoon 2.1.X version
and the image tag was simply:

        <img src="${imageNumber}.gif"/>

Why is the block name required in the path to fetch the image
when using cocoon 2.2? I would expect the location of the sitemap
to be the root for finding files. If I omit the block name, I
get an error of the form:

    javax.servlet.ServletException: No block for /148.gif

I have quite a bit of work to move from cocoon 2.1 to 2.2,
it would be nice if this behaviour could be configured to
go away...

Thanks for any insights...

-Hugh Sparks,

An outline of the block:

Block directory AAQuotes\src\main\resources\COB-INF:




        <map:flow language="javascript">
                <map:script src="flowscript.js"/>


        <map:match pattern="">
                <map:call function="startup"/>

        <map:match pattern="*.jx">
                <map:generate type="jx" src="{1}.jx"/>
                <map:transform type="xinclude"/>
                <map:serialize type="html"/>

        <map:match pattern="*.gif">
                <map:read mime-type="image/gif" src="images/{1}.gif"/>



        function startup()
        {        var q = Math.floor( Math.random() * numberOfQuotations + 
1).toString() ;
                  var m = Math.floor( Math.random() * numberOfImages + 
1).toString() ;
                  cocoon.sendPage("result.jx", {quoteNumber: q, imageNumber: 
m}) ;


        <?xml version="1.0"?>

        <html xmlns:xi="">

                        h3  { text-align: center }
                        img { padding-left: 5mm }
                        p   { text-align: center }

                <div style="width: 8cm">
                        <img src="AAQuotes/${imageNumber}.gif"/>



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message