/*
* Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
* Distributed under the terms of either:
* - the common development and distribution license (CDDL), v1.0; or
* - the GNU Lesser General Public License, v2.1 or later
* $Id: EngineTemplateInitializer.java 3810 2007-06-25 13:36:58Z gbevin $
*/
package com.uwyn.rife.engine;
import com.uwyn.rife.template.Template;
import com.uwyn.rife.template.TemplateInitializer;
public class EngineTemplateInitializer implements TemplateInitializer
{
public void initialize(Template template)
{
// Obtain the element that's active in the current running thread and
// obtain its context. It's not possible to store the element context
// in the initializer since that wouldn't work with continuations.
ElementSupport element = ElementContext.getActiveElementSupport();
if (null == element)
{
return;
}
// check for a valid element context
ElementContext context = element._getElementContext();
if (null == context)
{
return;
}
// set an element expression var
template.setExpressionVar("element", element);
// process the early embedded elements
context.processEmbeddedElementsEarly(template, element);
}
}
|