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 \
               -DgroupId=csparks.com \
               -DartifactId=AAQuotes

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, [EMAIL PROTECTED]


*******************************************************
An outline of the block:

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

       images/
               1.gif
               ...
               127.gif
       quotes.xml
       sitemap.xmap
       result.jx

Sitemap.xmap:

       ...

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

       <map:pipelines>
       <map:pipeline>

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

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

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

       ...

flowscript.js:

       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}) ;
       }

result.jx:

       <?xml version="1.0"?>

       <html xmlns:xi="http://www.w3.org/2001/XInclude";>

       <head>
               <title>Quotations</title>
               <style>
                       h3  { text-align: center }
                       img { padding-left: 5mm }
                       p   { text-align: center }
               </style>
       </head>

       <body>
               <div style="width: 8cm">
                       <h3>Quotations</h3>
                       <img src="AAQuotes/${imageNumber}.gif"/>
                       <p><i>
                               <xi:include
                                       href="quotes.xml"
                                       
xpointer="xpointer(/quotes/quote[${quoteNumber}])"
                               />
                       </i></p>
               </div>
       </body>

       </html>

*******************************************************


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to