Top Description Fields Constructors Methods
org.springframework.ui.freemarker

public Class SpringTemplateLoader

extends Object
implements freemarker.cache.TemplateLoader
Class Inheritance
Imports
java.io.IOException, .InputStreamReader, .Reader, freemarker.cache.TemplateLoader, org.apache.commons.logging.Log, .LogFactory, org.springframework.core.io.Resource, .ResourceLoader, org.springframework.lang.Nullable

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.
Author
Juergen Hoeller
Since
14.03.2004
See Also
FreeMarkerConfigurationFactory#setTemplateLoaderPath, freemarker.template.Configuration#setDirectoryForTemplateLoading

Field Summary

Modifier and TypeField and Description
protected final Log
private final ResourceLoader
private final String

Constructor Summary

AccessConstructor and Description
public
SpringTemplateLoader(ResourceLoader
the Spring ResourceLoader to use
resourceLoader
,
String
the template loader path to use
templateLoaderPath
)

Create a new SpringTemplateLoader.

Method Summary

Modifier and TypeMethod and Description
public void
closeTemplateSource(Object templateSource)

public Object
public long
getLastModified(Object templateSource)

public Reader
getReader(Object templateSource, String encoding)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loggerback to summary
protected final Log logger
resourceLoaderback to summary
private final ResourceLoader resourceLoader
templateLoaderPathback to summary
private final String templateLoaderPath

Constructor Detail

SpringTemplateLoaderback to summary
public SpringTemplateLoader(ResourceLoader resourceLoader, String templateLoaderPath)

Create a new SpringTemplateLoader.

Parameters
resourceLoader:ResourceLoader

the Spring ResourceLoader to use

templateLoaderPath:String

the template loader path to use

Method Detail

closeTemplateSourceback to summary
public void closeTemplateSource(Object templateSource) throws IOException
Annotations
@Override
findTemplateSourceback to summary
public Object findTemplateSource(String name) throws IOException
Annotations
@Override
@Nullable
getLastModifiedback to summary
public long getLastModified(Object templateSource)
Annotations
@Override
getReaderback to summary
public Reader getReader(Object templateSource, String encoding) throws IOException
Annotations
@Override