Cocoon 2.2 features a new concept for modularizing larger web applications. This allows you to have separate sitemaps mounted at different, configurable paths (like in a web.xml). You can also mount any servlet here. Inside sitemaps and other Cocoon "code" (eg. xslt, flowscript, etc., that uses Cocoon's source concept), you can call these servlets by using an URL like "servlet:foobarservlet:/resources/background-image.jpg".

Servlet Spring Bean Configuration

Example from the cocoon-servlet-service-sample block. This xml file (uniquely named cocoon-servlet-service-sample-servletService1.xml) must be in the directory "src/main/resources/META-INF/cocoon/spring" of your Cocoon 2.2 block created with Maven. The schema file for this custom bean config (the servlet: namespace prefix below is an extension provided by Cocoon) can be found here:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""

  <bean id="org.apache.cocoon.servletservice.sample.servlet1"
    <servlet:context mount-path="/cocoon-servlet-service-sample1"
        <entry key="foo" value="bar"/>
        <entry key="test2"

ServletService (last edited 2009-09-20 23:41:18 by localhost)