- TARGET-AUDIENCE: *beginner* advanced expert
- COCOON-RELEASES: 2.0.3, 2.0.4
- DOCUMENT-STATUS: *draft* reviewed released


This is a simple transformer that allows you to set HTTP response headers from the content of the XML that flows through the pipeline.

Other ways to set response headers are:

  <map:act type="header">
    <map:parameter name="Cache-Control" value="no-cache" />

  cocoon.response.setHeader("Cache-Control", "no-cache")

The ResponseHeaderTransformer is different from either of these methods, because it takes the header names and values from the XML that is processed by the pipeline.


Declaration in sitemap:

  <map:transformers default="xslt">
    <map:transformer name="response-headers" src="org.apache.cocoon.transformation.ResponseHeaderTransformer"/>

Usage in pipeline:

  <map:transform type="response-headers"/>

The transformer will look for elements in the "http://apache.org/cocoon/responseHeader/1.0" namespace:

<header:set name="Cache-Control" value="no-cache"

These elements are removed from the XML, and the header (Cache-Control) is set (to "no-cache").

Source code


ResponseHeaderTransformer (last edited 2009-09-20 23:41:48 by localhost)