If you're interested in functional programming, you might also want to checkout my second blog which i'm actively working on!!

Tuesday, May 4, 2010

Apache Cocoon: The sitemap servlet

In order to understand how a Cocoon block works we need to take a look at
src/main/resources/META-INF/cocoon/spring/block-servlet-service.xml

This file is a spring bean configuration file in which our sitemap servlet is configured. It describes we want to create an instance of the class 'org.apache.cocoon.sitemap.SitemapServlet' and name it 'com.ciber.cocoontutorial.service'.

The mount-path means that any request starting with '/cocoontutorial' will be dispatched to this servlet. The nice thing about a sitemap servlet is that we configure it's behaviour without ever having to write a single line of code. The configuration file is called sitemap.xmap and is located at
src/main/resources/COB-INF/sitemap.xmap.



Since I want to explain everything step-by-step I stripped everything from the sitemap.xmap which
was used for the sample. We're gonna create a much more advanced application so get ready for some action.



Important to know is that there is a 'map:flow' element (used for defining our flow controllers). .There are also 2 default pipelines to read internal and external resources from within your application. Css, Javascript and images would typically be stored inside the resource/external folder. Anything that would be application sensitive could be stored under resource/internal. The actual fact that these last resources are not available externally is configured by setting the attribute internal-only="true".


In the next article we'll start with explaining some sitemap components.

No comments:

Post a Comment