org.springframework.extensions.webscripts.processor
Class FTLTemplateProcessor

java.lang.Object
  extended by org.springframework.extensions.webscripts.processor.BaseProcessor
      extended by org.springframework.extensions.webscripts.processor.BaseRegisterableTemplateProcessor
          extended by org.springframework.extensions.webscripts.processor.AbstractTemplateProcessor
              extended by org.springframework.extensions.webscripts.processor.FTLTemplateProcessor
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener, Processor, TemplateProcessor

public class FTLTemplateProcessor
extends AbstractTemplateProcessor

FTL Template Processor for Alfresco Web Framework

Author:
davidc, kevinr

Field Summary
 
Fields inherited from class org.springframework.extensions.webscripts.processor.BaseProcessor
processorExtensions
 
Constructor Summary
FTLTemplateProcessor()
           
 
Method Summary
 String getDefaultEncoding()
          Gets the default encoding
 String getExtension()
          The file extension that the processor is associated with, null if none.
 String getName()
          Get the name of the processor
 boolean hasTemplate(String templatePath)
          Determines if a template exists
 void init()
          Inits the processor
protected  void initConfig()
          Initialise FreeMarker Configuration
 void process(String template, Object model, Writer out)
          Process a template against the supplied data model and write to the out.
 void processString(String template, Object model, Writer out)
          Process a string template against the supplied data model and write to the out.
 void reset()
          Reset the Template Processor
 void setCacheSize(int cacheSize)
           
 void setDefaultEncoding(String defaultEncoding)
           
 void setUpdateDelay(int updateDelay)
           
 
Methods inherited from class org.springframework.extensions.webscripts.processor.AbstractTemplateProcessor
addProcessorModelExtensions, getSearchPath, getTemplateLoader, initLoaders, onApplicationEvent, register, setApplicationContext, setSearchPath
 
Methods inherited from class org.springframework.extensions.webscripts.processor.BaseRegisterableTemplateProcessor
getTemplateProcessorRegistry, setTemplateProcessorRegistry
 
Methods inherited from class org.springframework.extensions.webscripts.processor.BaseProcessor
registerProcessorExtension
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FTLTemplateProcessor

public FTLTemplateProcessor()
Method Detail

setDefaultEncoding

public void setDefaultEncoding(String defaultEncoding)
Parameters:
defaultEncoding -

getDefaultEncoding

public String getDefaultEncoding()
Description copied from interface: TemplateProcessor
Gets the default encoding

Returns:
default encoding

setUpdateDelay

public void setUpdateDelay(int updateDelay)
Parameters:
updateDelay - the time in seconds between checks on the modified date for cached templates

setCacheSize

public void setCacheSize(int cacheSize)
Parameters:
cacheSize - the size of the MRU template cache, default is 256

init

public void init()
Description copied from class: BaseRegisterableTemplateProcessor
Inits the processor

Overrides:
init in class AbstractTemplateProcessor

getExtension

public String getExtension()
Description copied from interface: Processor
The file extension that the processor is associated with, null if none.

Returns:
the extension

getName

public String getName()
Description copied from interface: Processor
Get the name of the processor

Returns:
the name of the processor

process

public void process(String template,
                    Object model,
                    Writer out)
Description copied from interface: TemplateProcessor
Process a template against the supplied data model and write to the out.

Parameters:
template - Template name/path
model - Object model to process template against
out - Writer object to send output too

processString

public void processString(String template,
                          Object model,
                          Writer out)
Description copied from interface: TemplateProcessor
Process a string template against the supplied data model and write to the out.

Parameters:
template - Template string
model - Object model to process template against
out - Writer object to send output too

reset

public void reset()
Description copied from interface: TemplateProcessor
Reset the Template Processor


hasTemplate

public boolean hasTemplate(String templatePath)
Description copied from interface: TemplateProcessor
Determines if a template exists

Returns:
true => exists

initConfig

protected void initConfig()
Initialise FreeMarker Configuration



Copyright © 2009 SpringSource, Inc. All Rights Reserved.