public interface Template
The interface for all templates. A template is an object which can executed with a given template context to produce content of some kind. Typically the template is defined with some template language. The template is read from a file and the bulk of the output in literal text with some special markup for dynamic elements. The dynamic elements may then refer to the variables in the template context to fill in the rest of the page.
The interface however is generic enough for many other types of templates too. You need not read a template from an actual file. Any kind of dynamic content generation based on some context parameters could work as a template.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getEncoding()
Returns the character encoding used by the returned content.
|
java.lang.String |
getKey()
Returns the template key.
|
java.lang.String |
getMimeType()
Returns the mime type of the content from this template.
|
java.util.HashMap<java.lang.String,java.lang.Object> |
getTemplateContext()
Returns the default context for this template.
|
java.lang.String |
getVersion()
Returns the template version.
|
void |
process(java.util.HashMap<java.lang.String,java.lang.Object> params,
java.io.OutputStream output)
Processes the template with the given context and writes the resulting
content in the output stream.
|
java.lang.String getKey()
java.lang.String getVersion()
java.lang.String getMimeType()
java.lang.String getEncoding()
void process(java.util.HashMap<java.lang.String,java.lang.Object> params, java.io.OutputStream output)
params
- The template context used for processing of the template.output
- The output stream where the result is written.java.util.HashMap<java.lang.String,java.lang.Object> getTemplateContext()
Copyright 2004-2015 Wandora Team