You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by da...@cocoon.zones.apache.org on 2008/08/17 18:02:31 UTC

[DAISY] Updated: EventAwareGenerator

A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1493.html

Document ID: 1493
Branch: main
Language: default
Name: EventAwareGenerator (unchanged)
Document Type: Sitemap Component (unchanged)
Updated on: 8/17/08 4:02:16 PM
Updated by: Lukas Lang

A new version has been created, state: draft

Parts
=====

Short description
-----------------
This part has been added.
Mime type: text/xml
File name: null
Size: 220 bytes
Content:
<html>
<body>

<p>EventAwareGenerator is a <em>JXTemplateGenerator</em>, used in the sample.
The generator can be used to serve any content, using events, identified by keys
for content invalidation.</p>

</body>
</html>


Long description
----------------
This part has been added.
Mime type: text/xml
File name: null
Size: 1576 bytes
Content:
<html>
<body>

<h3>Example</h3>

<p>In this sample, a the EventAwareGenerator is used to serve the date and time
of first page generation, which becomes cached content. Furthermore, it slows
down page generation by two seconds. Cached content is identified by the
<em>pageKey</em>.</p>

<pre>  &lt;map:pipelines type="event-aware"&gt;
    &lt;map:pipeline&gt;
      &lt;map:match pattern="*"&gt;
        &lt;map:generate src="eventcache.xml" type="EventCacheSample"&gt;
          &lt;map:parameter name="DELAY_SECS" value="2" /&gt;
          &lt;map:parameter name="DATE" value="{date:date}" /&gt;
          &lt;map:parameter name="KEY" value="{request-param:pageKey}" /&gt;
        &lt;/map:generate&gt;
        &lt;!-- Make use of servlet services --&gt;
        &lt;map:serialize type="servletService"&gt;
          &lt;map:parameter name="service"
            value="servlet:style-default:/service/blocks/dynamic-page2html"/&gt;
        &lt;/map:serialize&gt;
      &lt;/map:match&gt;
    &lt;/map:pipeline&gt;
  &lt;/map:pipelines&gt;</pre>

<h3>Configuration</h3>

<p>The generator can be defined as a Spring bean, without meeting special
demands.</p>

<pre>  &lt;!-- Event aware generator bean inherits from the jx generator --&gt;
  &lt;bean name="org.apache.cocoon.generation.Generator/EventCacheSample"
    class="org.apache.cocoon.samples.EventAwareGenerator" scope="prototype"
    parent="org.apache.cocoon.generation.Generator/jx" /&gt;</pre>

</body>
</html>


Fields
======
CocoonComponentReference: Generator (new field)
CocoonBlock: eventcache (new field)
Cacheability info (DO NOT EDIT): Yes (new field)
FQ Java class: org.apache.cocoon.samples.EventAwareGenerator (new field)