org.springframework.extensions.webscripts
Class FreemarkerProcessor

java.lang.Object
  extended by org.springframework.extensions.surf.render.AbstractProcessor
      extended by org.springframework.extensions.webscripts.FreemarkerProcessor
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener, Processor

public class FreemarkerProcessor
extends AbstractProcessor

Implementation of a renderer that executes a Freemarker template.

Author:
muzquiano, kevinr

Field Summary
static String PREFIX_CLASSPATH
           
 
Constructor Summary
FreemarkerProcessor()
           
 
Method Summary
 void executeBody(ProcessorContext pc)
          Execute.
 void executeHeader(ProcessorContext pc)
          Executes the "header" of the processor output using the given processor context.
 boolean exists(ProcessorContext pc)
          Indicates whether the engine responsible for processing the body of the processor exists.
 ScriptProcessorRegistry getScriptProcessorRegistry()
          Gets the script processor registry.
 TemplateProcessorRegistry getTemplateProcessorRegistry()
          Gets the template processor registry.
 void init(org.springframework.context.ApplicationContext applicationContext)
          Initialisation hook point.
protected  String loadTemplateStringFromPath(String templatePath)
           
 void setScriptObjects(Map<String,Object> scriptObjects)
          Set any additional objects to be applied to the script model when executing any JavaScript attached to the template.
 void setScriptProcessorRegistry(ScriptProcessorRegistry scriptProcessorRegistry)
          Sets the script processor registry.
 void setTemplateProcessorRegistry(TemplateProcessorRegistry templateProcessorRegistry)
          Sets the template processor registry.
 
Methods inherited from class org.springframework.extensions.surf.render.AbstractProcessor
execute, executeFooter, getProperty, getRenderingDescriptor, getRenderingDescriptor, onApplicationEvent, setApplicationContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PREFIX_CLASSPATH

public static final String PREFIX_CLASSPATH
See Also:
Constant Field Values
Constructor Detail

FreemarkerProcessor

public FreemarkerProcessor()
Method Detail

init

public void init(org.springframework.context.ApplicationContext applicationContext)
Description copied from interface: Processor
Initialisation hook point. This will be called exactly once when the processor is instantiated. It does not have access to request time information.

Specified by:
init in interface Processor
Overrides:
init in class AbstractProcessor
Parameters:
applicationContext - the application context

setTemplateProcessorRegistry

public void setTemplateProcessorRegistry(TemplateProcessorRegistry templateProcessorRegistry)
Sets the template processor registry.

Parameters:
templateProcessorRegistry - the new template processor registry

getTemplateProcessorRegistry

public TemplateProcessorRegistry getTemplateProcessorRegistry()
Gets the template processor registry.

Returns:
the template processor registry

setScriptProcessorRegistry

public void setScriptProcessorRegistry(ScriptProcessorRegistry scriptProcessorRegistry)
Sets the script processor registry.

Parameters:
scriptProcessorRegistry - the new script processor registry

getScriptProcessorRegistry

public ScriptProcessorRegistry getScriptProcessorRegistry()
Gets the script processor registry.

Returns:
the script processor registry

setScriptObjects

public void setScriptObjects(Map<String,Object> scriptObjects)
Set any additional objects to be applied to the script model when executing any JavaScript attached to the template.

Parameters:
scriptObjects -

executeHeader

public void executeHeader(ProcessorContext pc)
                   throws RendererExecutionException
Description copied from interface: Processor
Executes the "header" of the processor output using the given processor context.

Specified by:
executeHeader in interface Processor
Overrides:
executeHeader in class AbstractProcessor
Parameters:
pc - processorContext
Throws:
RendererExecutionException

executeBody

public void executeBody(ProcessorContext pc)
                 throws RendererExecutionException
Execute.

Specified by:
executeBody in interface Processor
Specified by:
executeBody in class AbstractProcessor
Parameters:
pc - the processor context
Throws:
RendererExecutionException - the renderer execution exception

exists

public boolean exists(ProcessorContext pc)
Description copied from interface: Processor
Indicates whether the engine responsible for processing the body of the processor exists.

Returns:

loadTemplateStringFromPath

protected String loadTemplateStringFromPath(String templatePath)
                                     throws IOException
Throws:
IOException


Copyright © 2009 SpringSource, Inc. All Rights Reserved.