cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernhard Huber <>
Subject [announcement] JSP, Servlet2.3 Filter CocoonFilterGeneratorImpl, and RequestAttributeGenerator
Date Sun, 21 Apr 2002 10:36:15 GMT
hi, folks

as i could not make JSPEngine working under WLS6.1,
i choose a different approach which is more general and
ASFAIK servlet 2.3 conformant.

I implemented a servlet 2.3 filter CocoonFilterGeneratorImpl.
This filter processes all entries of the filter chain first, and
save the response in a local response.
As final step a cocoon servlet instance services the
original request, having the local response as request-attribute.
A RequestAttributeGenerator pipes the value of the request-attribute
into the Cocoon pipeline.
RequestAttributeGenerator is more or less like StreamGenerator.

The cocoon servlet instance uses the original response for sending
response to the client.

As a consequence each filter instance initializes/destroyes its own 
cocoon servlet instance.

Now this kind of approach is not limited to processing JSP, but you may
define any servlet, or other filters as pre-processing steps of this filter.

I think this is the only Servlet 2.3 conformant way to process JSP 
output in Cocoon.

Names & Commits

I will commit the filter as 
and org.apache.cocoon.generation.RequestAttributeGenerator into scratchpad.

Moreover CocoonFilterGeneratorImpl explains how-to setup your web.xml, 
and your

Configuration snippet for web.xml
    <description>Run JSP/Servlet processing before feeding into 


Note by default jsp files are handled by the JSP servlet.
Cocoon servlet does not need to get mapped to *.jsp anymore.

Configuration snippet for sittemap.xmap:
   <map:match pattern="docs/samples/jsp/*">
    <map:generate type="req-attr"/>
    <!--map:generate src="docs/samples/jsp/{1}.jsp" type="jsp"/-->

    <map:transform src="stylesheets/page/simple-page2html.xsl">
        <map:parameter name="view-source" value="docs/samples/jsp/{1}.jsp"/>
       Run-time configuration is done through these
       <map:parameter/> elements. Again, let's have a look at the

       "[...] All <map:parameter> declarations will be made
       available in the XSLT stylesheet as xsl:variables. [...]"
    <map:transform type="log"/>
Note: You must use the request URI, as matching is already done by the 
servlet container,
thus the original sitemap JSP sample matching="jsp/*" will not work.

bye bernhard

To unsubscribe, e-mail:
For additional commands, email:

View raw message