blob: 40ae93abfa5429d265fc85cbfa9fca3157f28e7c [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Velocity Generator</title>
<link href="http://purl.org/DC/elements/1.0/" rel="schema.DC">
<meta content="in @doctitle@" name="DC.Subject">
<meta content="Carsten Ziegeler" name="DC.Creator">
<meta content="This document describes the Velocity template generator." name="DC.Description">
</head>
<body>
<h1>Velocity Generator</h1>
<p>
Allows Velocity template to be used as a generator.
Builds upon the Velocity servlet functionality - overrides
the output method in order to pipe the results into SAX events.
</p>
<ul>
<li>Name : velocity</li>
<li>Class: org.apache.cocoon.generation.VelocityGenerator</li>
<li>Cacheable: ????.</li>
</ul>
<pre class="code">
&lt;map:generate type="velocity"/&gt;
</pre>
<p>
Cocoon Generator that produces dynamic XML SAX events
from a Velocity template file.
</p>
<h2>Sitemap Configuration</h2>
<p>
Attributes:
</p>
<dl>
<dt>usecache (optional; default: 'false')</dt>
<dd>
set to 'true' to enable template caching on the 'cocoon'
resource loader
</dd>
<dt>checkInterval (optional; default: '0')</dt>
<dd>
This is the number of seconds between modification checks when
caching is turned on. When this is an integer &gt; 0, this represents
the number of seconds between checks to see if the template was
modified. If the template has been modified since last check, then
it is reloaded and reparsed. Otherwise nothing is done. When &lt;= 0,
no modification checks will take place, and assuming that the
property cache (above) is true, once a template is loaded and
parsed the first time it is used, it will not be checked or
reloaded after that until the application or servlet engine is
restarted.
</dd>
</dl>
<p>
Child Elements:
</p>
<dl>
<dt>&lt;property name="propertyName" value="propertyValue"/&gt;
(optional; 0..n)</dt>
<dd>
An additional property to pass along to the Velocity template
engine during initialization
</dd>
<dt>&lt;resource-loader name="loaderName" class="javaClassName"/&gt;
(optional; 0..n; children: property*)</dt>
<dd>
The default configuration uses the 'cocoon' resource loader
which resolves resources via the Cocoon SourceResolver. Additional
resource loaders can be added with this configuration
element. Configuration properties for the resource loader can be
specified by adding a child property element of the resource-loader
element. The prefix '&lt;name&gt;.resource.loader.' is
automatically added to the property name.
</dd>
<dt>&lt;export-object key="objectMapKey" name="velocityContextName"/&gt;
(optional; 0..n)</dt>
<dd>
Export the object specified by <em>key</em> from the Cocoon
object map to the Velocity context of the template. The object can
be accessed from the template as <em>name</em>. Be careful to use a
valid VTL variable name.
</dd>
</dl>
<p>
Default Java objects exported to the Velocity context:
</p>
<dl>
<dt>request (org.apache.cocoon.environment.Request)</dt>
<dd>The Cocoon current request</dd>
<dt>template (java.lang.String)</dt>
<dd>The path of the template file currently being evaluated</dd>
<dt>response (org.apache.cocoon.environment.Response)</dt>
<dd>The Cocoon response associated with the current request</dd>
<dt>context (org.apache.cocoon.environment.Context)</dt>
<dd>The Cocoon context associated with the current request</dd>
<dt>parameters (org.apache.avalon.framework.parameters.Parameters)</dt>
<dd>Any parameters passed to the generator in the pipeline</dd>
</dl>
</body>
</html>