XPatch
The xpatch mechanism enables you to split up your web.xml and put the snippets into the block it belongs too. It takes all *.xweb files from src/main/resources/META-INF/cocoon/xpatch and applies them to the generated web.xml file that you will find in target/rcl/webapp/WEB-INF/web.xml.
Here is an example of an xweb file:
<xweb xpath="/web-app"
unless="comment()[contains(., 'Xindice XML-RPC Server servlet configuration')]"
insert-after="servlet[last()]">
<!-- XMLDB Block, Xindice XML-RPC Server servlet configuration -->
<servlet>
<servlet-name>Xindice</servlet-name>
<display-name>Xindice XML-RPC Server</display-name>
<servlet-class>org.apache.xindice.server.XindiceServlet</servlet-class>
<init-param>
<param-name>xindice.configuration</param-name>
<param-value>WEB-INF/xindice.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
</xweb>
This xweb file adds the Xindice-RPC Server servlet to your web.xml.
Syntax
|
description |
|
|---|---|
|
xweb |
That's the root element. Everything it contains will be applied. |
|
@xpath |
The xpatch within web.xml where the xweb snippet should be applied to. |
|
@unless |
A condition when the patch should NOT be applied. |
|
@insert-after |
Define the exact position within result of the xpath. |


