Package groovy.text.markup
Class MarkupTemplateEngine
java.lang.Object
groovy.text.TemplateEngine
groovy.text.markup.MarkupTemplateEngine
public class MarkupTemplateEngine extends TemplateEngine
A template engine which leverages
StreamingMarkupBuilder
to generate XML/XHTML.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MarkupTemplateEngine.CachingTemplateResolver
A template resolver which avoids callingClassLoader.getResource(String)
if a template path already has been queried before.static class
MarkupTemplateEngine.DefaultTemplateResolver
static class
MarkupTemplateEngine.TemplateResource
-
Constructor Summary
Constructors Constructor Description MarkupTemplateEngine()
MarkupTemplateEngine(TemplateConfiguration config)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration config)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration config, TemplateResolver resolver)
MarkupTemplateEngine(java.lang.ClassLoader parentLoader, java.io.File templateDirectory, TemplateConfiguration tplConfig)
Convenience constructor to build a template engine which searches for templates into a directory -
Method Summary
Modifier and Type Method Description Template
createTemplate(java.io.Reader reader)
Creates a template by reading content from the Reader.Template
createTemplate(java.io.Reader reader, java.lang.String sourceName)
Template
createTemplate(java.net.URL resource)
Creates a template from the content found at the URL using the default encoding.Template
createTemplateByPath(java.lang.String templatePath)
Template
createTypeCheckedModelTemplate(java.io.Reader reader, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.lang.String source, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplate(java.net.URL resource, java.util.Map<java.lang.String,java.lang.String> modelTypes)
Template
createTypeCheckedModelTemplateByPath(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.String> modelTypes)
CompilerConfiguration
getCompilerConfiguration()
TemplateConfiguration
getTemplateConfiguration()
GroovyClassLoader
getTemplateLoader()
java.net.URL
resolveTemplate(java.lang.String templatePath)
Methods inherited from class groovy.text.TemplateEngine
createTemplate, createTemplate, createTemplate, createTemplate
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
MarkupTemplateEngine
public MarkupTemplateEngine() -
MarkupTemplateEngine
-
MarkupTemplateEngine
-
MarkupTemplateEngine
public MarkupTemplateEngine(java.lang.ClassLoader parentLoader, TemplateConfiguration config, TemplateResolver resolver) -
MarkupTemplateEngine
public MarkupTemplateEngine(java.lang.ClassLoader parentLoader, java.io.File templateDirectory, TemplateConfiguration tplConfig)Convenience constructor to build a template engine which searches for templates into a directory- Parameters:
templateDirectory
- directory where to find templatestplConfig
- template engine configuration
-
-
Method Details
-
createTemplate
public Template createTemplate(java.io.Reader reader) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOExceptionDescription copied from class:TemplateEngine
Creates a template by reading content from the Reader.- Specified by:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplate
public Template createTemplate(java.io.Reader reader, java.lang.String sourceName) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplateByPath
public Template createTemplateByPath(java.lang.String templatePath) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.lang.String source, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.lang.String source, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.io.Reader reader, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.io.Reader reader, java.lang.String sourceName, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplateByPath
public Template createTypeCheckedModelTemplateByPath(java.lang.String templatePath, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTemplate
public Template createTemplate(java.net.URL resource) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOExceptionDescription copied from class:TemplateEngine
Creates a template from the content found at the URL using the default encoding. Please consider usingTemplateEngine.createTemplate(URL, Charset)
.- Overrides:
createTemplate
in classTemplateEngine
- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
createTypeCheckedModelTemplate
public Template createTypeCheckedModelTemplate(java.net.URL resource, java.util.Map<java.lang.String,java.lang.String> modelTypes) throws CompilationFailedException, java.lang.ClassNotFoundException, java.io.IOException- Throws:
CompilationFailedException
java.lang.ClassNotFoundException
java.io.IOException
-
getTemplateLoader
-
getCompilerConfiguration
-
getTemplateConfiguration
-
resolveTemplate
public java.net.URL resolveTemplate(java.lang.String templatePath) throws java.io.IOException- Throws:
java.io.IOException
-