Class FTLTemplateProcessor
- java.lang.Object
-
- org.springframework.extensions.webscripts.processor.BaseProcessor
-
- org.springframework.extensions.webscripts.processor.BaseRegisterableTemplateProcessor
-
- org.springframework.extensions.webscripts.processor.AbstractTemplateProcessor
-
- org.springframework.extensions.webscripts.processor.FTLTemplateProcessor
-
- All Implemented Interfaces:
java.util.EventListener,org.springframework.beans.factory.Aware,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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFTLTemplateProcessor.NonBlockingObjectWrapperImplements the FreeMarker ObjectWrapper cache as a ThreadLocal to avoid blocking when interogating or populating the bean cache.
-
Field Summary
-
Fields inherited from class org.springframework.extensions.webscripts.processor.BaseProcessor
processorExtensions
-
-
Constructor Summary
Constructors Constructor Description FTLTemplateProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDefaultEncoding()Gets the default encodingjava.lang.StringgetExtension()The file extension that the processor is associated with, null if none.java.lang.StringgetName()Get the name of the processorbooleanhasTemplate(java.lang.String templatePath)Determines if a template existsvoidinit()Inits the processorprotected voidinitConfig()Initialise FreeMarker Configurationprotected booleanisDebugMode()voidprocess(java.lang.String template, java.lang.Object model, java.io.Writer out)Process a template against the supplied data model and write to the out.voidprocessString(java.lang.String template, java.lang.Object model, java.io.Writer out)Process a string template against the supplied data model and write to the out.voidreset()Reset the Template ProcessorvoidsetCacheSize(int cacheSize)voidsetConfigService(org.springframework.extensions.config.ConfigService configService)Sets the config service.voidsetDefaultEncoding(java.lang.String defaultEncoding)voidsetUpdateDelay(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
-
-
-
-
Method Detail
-
setConfigService
public void setConfigService(org.springframework.extensions.config.ConfigService configService)
Sets the config service.- Parameters:
configService- The ConfigService
-
setDefaultEncoding
public void setDefaultEncoding(java.lang.String defaultEncoding)
- Parameters:
defaultEncoding- String
-
getDefaultEncoding
public java.lang.String getDefaultEncoding()
Description copied from interface:TemplateProcessorGets 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:BaseRegisterableTemplateProcessorInits the processor- Overrides:
initin classAbstractTemplateProcessor
-
getExtension
public java.lang.String getExtension()
Description copied from interface:ProcessorThe file extension that the processor is associated with, null if none.- Returns:
- the extension
-
getName
public java.lang.String getName()
Description copied from interface:ProcessorGet the name of the processor- Returns:
- the name of the processor
-
process
public void process(java.lang.String template, java.lang.Object model, java.io.Writer out)Description copied from interface:TemplateProcessorProcess a template against the supplied data model and write to the out.- Parameters:
template- Template name/pathmodel- Object model to process template againstout- Writer object to send output too
-
processString
public void processString(java.lang.String template, java.lang.Object model, java.io.Writer out)Description copied from interface:TemplateProcessorProcess a string template against the supplied data model and write to the out.- Parameters:
template- Template stringmodel- Object model to process template againstout- Writer object to send output too
-
reset
public void reset()
Description copied from interface:TemplateProcessorReset the Template Processor
-
hasTemplate
public boolean hasTemplate(java.lang.String templatePath)
Description copied from interface:TemplateProcessorDetermines if a template exists- Parameters:
templatePath- String- Returns:
- true => exists
-
initConfig
protected void initConfig()
Initialise FreeMarker Configuration
-
isDebugMode
protected boolean isDebugMode()
-
-