org.riotfamily.common.web.view.freemarker
Class RiotFreeMarkerConfigurer

java.lang.Object
  extended by org.springframework.ui.freemarker.FreeMarkerConfigurationFactory
      extended by org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
          extended by org.riotfamily.common.web.view.freemarker.RiotFreeMarkerConfigurer
All Implemented Interfaces:
InitializingBean, ApplicationContextAware, ResourceLoaderAware, ServletContextAware, FreeMarkerConfig
Direct Known Subclasses:
WebsiteFreeMarkerConfigurer

public class RiotFreeMarkerConfigurer
extends FreeMarkerConfigurer
implements ApplicationContextAware

FreeMarkerConfigurer that supports some additional settings.

Since:
6.4
Author:
Felix Gnass [fgnass at neteye dot de]

Field Summary
 
Fields inherited from class org.springframework.ui.freemarker.FreeMarkerConfigurationFactory
logger
 
Constructor Summary
RiotFreeMarkerConfigurer()
           
 
Method Summary
protected  void importMacroLibraries(freemarker.template.Configuration config)
           
protected  void postProcessConfiguration(freemarker.template.Configuration config)
           
protected  void postProcessTemplateLoaders(List templateLoaders)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void setExceptionHandler(freemarker.template.TemplateExceptionHandler exceptionHandler)
          Sets the TemplateExceptionHandler to be used.
 void setExposeStaticModels(boolean exposeStaticModels)
          Whether BeansWrapper.getStaticModels() should be exposed as statics.
 void setFreemarkerVariables(Map variables)
          Set a Map that contains well-known FreeMarker objects which will be passed to FreeMarker's Configuration.setAllSharedVariables() method.
 void setMacroLibraries(Properties macroLibraries)
          Sets the macro libraries to be auto-imported, keyed by their namespace.
 void setTemplateUpdateDelay(int templateUpdateDelay)
          Set the time in seconds that must elapse before checking whether there is a newer version of a template file.
 void setUrlEscapingCharset(String urlEscapingCharset)
          Sets the URL escaping charset.
 void setUseComputerNumberFormat(boolean useComputerNumberFormat)
          Whether the #0.
 void setUseTemplateCache(boolean useTemplateCache)
          Sets whether the FreeMarker template cache should be used (default is true).
 void setWhitespaceStripping(boolean whitespaceStripping)
          Sets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.
 
Methods inherited from class org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
afterPropertiesSet, getConfiguration, getTaglibFactory, setConfiguration, setServletContext
 
Methods inherited from class org.springframework.ui.freemarker.FreeMarkerConfigurationFactory
createConfiguration, getAggregateTemplateLoader, getResourceLoader, getTemplateLoaderForPath, isPreferFileSystemAccess, newConfiguration, setConfigLocation, setDefaultEncoding, setFreemarkerSettings, setPostTemplateLoaders, setPreferFileSystemAccess, setPreTemplateLoaders, setResourceLoader, setTemplateLoaderPath, setTemplateLoaderPaths, setTemplateLoaders
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.context.ResourceLoaderAware
setResourceLoader
 

Constructor Detail

RiotFreeMarkerConfigurer

public RiotFreeMarkerConfigurer()
Method Detail

setMacroLibraries

public void setMacroLibraries(Properties macroLibraries)
Sets the macro libraries to be auto-imported, keyed by their namespace.


setExceptionHandler

public void setExceptionHandler(freemarker.template.TemplateExceptionHandler exceptionHandler)
Sets the TemplateExceptionHandler to be used. By default an ErrorPrintingExceptionHandler will be used.


setFreemarkerVariables

public void setFreemarkerVariables(Map variables)
Set a Map that contains well-known FreeMarker objects which will be passed to FreeMarker's Configuration.setAllSharedVariables() method.

Riot overrides this setter in order to set the variables in postProcessConfiguration(Configuration), after the custom ObjectWrapper has been set.

Overrides:
setFreemarkerVariables in class FreeMarkerConfigurationFactory
See Also:
Configuration.setAllSharedVariables(freemarker.template.TemplateHashModelEx)

setWhitespaceStripping

public void setWhitespaceStripping(boolean whitespaceStripping)
Sets whether the FTL parser will try to remove superfluous white-space around certain FTL tags.


setUrlEscapingCharset

public void setUrlEscapingCharset(String urlEscapingCharset)
Sets the URL escaping charset. Allows null, which means that the output encoding will be used for URL escaping. Default is UTF-8.


setUseComputerNumberFormat

public void setUseComputerNumberFormat(boolean useComputerNumberFormat)
Whether the #0.# should be used as default number format. Default is true.


setExposeStaticModels

public void setExposeStaticModels(boolean exposeStaticModels)
Whether BeansWrapper.getStaticModels() should be exposed as statics.


setUseTemplateCache

public void setUseTemplateCache(boolean useTemplateCache)
Sets whether the FreeMarker template cache should be used (default is true).


setTemplateUpdateDelay

public void setTemplateUpdateDelay(int templateUpdateDelay)
Set the time in seconds that must elapse before checking whether there is a newer version of a template file. Default is 5.


setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
Specified by:
setApplicationContext in interface ApplicationContextAware

postProcessTemplateLoaders

protected void postProcessTemplateLoaders(List templateLoaders)
Overrides:
postProcessTemplateLoaders in class FreeMarkerConfigurer

postProcessConfiguration

protected void postProcessConfiguration(freemarker.template.Configuration config)
                                 throws IOException,
                                        freemarker.template.TemplateException
Overrides:
postProcessConfiguration in class FreeMarkerConfigurationFactory
Throws:
IOException
freemarker.template.TemplateException

importMacroLibraries

protected void importMacroLibraries(freemarker.template.Configuration config)