org.springframework.ui.freemarker
Class SpringTemplateLoader
java.lang.Object
org.springframework.ui.freemarker.SpringTemplateLoader
- All Implemented Interfaces:
- freemarker.cache.TemplateLoader
- public class SpringTemplateLoader
- extends java.lang.Object
- implements freemarker.cache.TemplateLoader
FreeMarker TemplateLoader adapter that loads via a Spring ResourceLoader.
Used by FreeMarkerConfigurationFactory for any resource loader path that
cannot be resolved to a java.io.File.
Note that this loader does not allow for modification detection:
Use FreeMarker's default TemplateLoader for java.io.File resources.
- Since:
- 14.03.2004
- Author:
- Juergen Hoeller
- See Also:
FreeMarkerConfigurationFactory.setTemplateLoaderPath(java.lang.String)
,
Configuration.setDirectoryForTemplateLoading(java.io.File)
Field Summary |
protected org.apache.commons.logging.Log |
logger
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected final org.apache.commons.logging.Log logger
SpringTemplateLoader
public SpringTemplateLoader(ResourceLoader resourceLoader,
java.lang.String templateLoaderPath)
- Create a new SpringTemplateLoader.
- Parameters:
resourceLoader
- the Spring ResourceLoader to usetemplateLoaderPath
- the template loader path to use
findTemplateSource
public java.lang.Object findTemplateSource(java.lang.String name)
throws java.io.IOException
- Specified by:
findTemplateSource
in interface freemarker.cache.TemplateLoader
- Throws:
java.io.IOException
getLastModified
public long getLastModified(java.lang.Object templateSource)
- Specified by:
getLastModified
in interface freemarker.cache.TemplateLoader
getReader
public java.io.Reader getReader(java.lang.Object templateSource,
java.lang.String encoding)
throws java.io.IOException
- Specified by:
getReader
in interface freemarker.cache.TemplateLoader
- Throws:
java.io.IOException
closeTemplateSource
public void closeTemplateSource(java.lang.Object templateSource)
throws java.io.IOException
- Specified by:
closeTemplateSource
in interface freemarker.cache.TemplateLoader
- Throws:
java.io.IOException
Copyright (C) 2003-2004 The Spring Framework Project.