I have 2 blocks (block-a and block-b) and I want to serve an xml from block-b in block-a so i did the following:

block-a/block-servlet-service.xml:
<servlet:context mount-path="/block-a" context-path="blockcontext:/block-a/">
<servlet:connections>
<entry key="block-b" value-ref="com.my-company.block-b.service"/>
</servlet:connections>
</servlet:context>

block-a/sitemap.xml:
<map:pipeline>
<map:match pattern="document">
<map:generate src="servlet:block-b:/document" />
<map:serialize type="xml" />
</map:match>
</map:pipeline>

That way i can read the my document using /block-a/document. In certain instances block-b wont be included in the war so I want the /block-a/document to go to a default document in block-a so I thought of adding an error handler, something like this:

<map:pipeline>
<map:match pattern="document">
<map:generate src="servlet:block-b:/document" />
<map:serialize type="xml" />
</map:match>
<map:handle-errors>
<map:select type="exception">
<map:when test="error">
<map:generate type="file" src="block-a-resources/document.xml" />
<map:serialize type="xml"/>
</map:when>
</map:select>
</map:handle-errors>
</map:pipeline>

Since the connection in the block-a/block-servlet-service.xml cannot be made the war is not loaded so this method wont work. Is there another way to do this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@cocoon.apache.org
For additional commands, e-mail: users-h...@cocoon.apache.org

Reply via email to