public class TemplateRepresentation extends WriterRepresentation
Modifier and Type | Field and Description |
---|---|
protected org.thymeleaf.context.IContext |
context
The template's data model.
|
UNKNOWN_SIZE
Constructor and Description |
---|
TemplateRepresentation(java.lang.String templateName,
java.util.Locale locale,
java.util.Map<java.lang.String,java.lang.Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
java.util.Locale locale,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
org.thymeleaf.TemplateEngine engine,
java.util.Locale locale,
java.util.Map<java.lang.String,java.lang.Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
org.thymeleaf.TemplateEngine engine,
java.util.Locale locale,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(TemplateRepresentation templateRepresentation,
java.util.Locale locale,
MediaType mediaType)
Constructor based on a Thymeleaf 'encoded' representation.
|
TemplateRepresentation(TemplateRepresentation templateRepresentation,
org.thymeleaf.TemplateEngine engine,
java.util.Locale locale,
MediaType mediaType)
Constructor based on a Thymeleaf 'encoded' representation.
|
Modifier and Type | Method and Description |
---|---|
static org.thymeleaf.TemplateEngine |
createTemplateEngine()
Returns a new instance of
TemplateEngine based by default on a
TemplateResolver returned by calling
createTemplateResolver() . |
static org.thymeleaf.TemplateEngine |
createTemplateEngine(org.thymeleaf.templateresolver.ITemplateResolver resolver)
Returns a new instance of
TemplateEngine based by default on a
TemplateResolver returned by calling
createTemplateResolver() . |
static org.thymeleaf.templateresolver.ITemplateResolver |
createTemplateResolver()
Returns a new instance of
ITemplateResolver with default
configuration (XHTML template model, templates located inside
"/WEB-INF/templates/", suffixed by ".html". |
java.util.Locale |
getLocale()
Returns the representation's locale.
|
java.lang.String |
getTemplateName()
Returns the template's name.
|
protected void |
setContext(org.thymeleaf.context.IContext context)
Sets the Thymeleaf context.
|
void |
setDataModel(java.util.Map<java.lang.String,java.lang.Object> dataModel)
Sets the template's data model.
|
void |
setDataModel(Request request,
Response response)
Sets the template's data model from a request/response pair.
|
void |
setDataModel(Resolver<java.lang.Object> resolver)
Sets the template's data model from a resolver.
|
void |
setTemplateName(java.lang.String templateName)
Sets the template's name.
|
void |
write(java.io.Writer writer)
Writes the datum as a stream of characters.
|
getReader
getChannel, getStream, write, write
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient
getModificationDate, getTag, setModificationDate, setTag
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString
protected volatile org.thymeleaf.context.IContext context
public TemplateRepresentation(java.lang.String templateName, java.util.Locale locale, java.util.Map<java.lang.String,java.lang.Object> dataModel, MediaType mediaType)
templateName
- The Thymeleaf template's name. The actual template is
retrieved using the Thymeleaf configuration.locale
- The locale of the template.dataModel
- The Thymeleaf template's data model.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, java.util.Locale locale, MediaType mediaType)
templateName
- The Thymeleaf template's name. The full path is resolved by
the configuration.locale
- The locale of the template.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, org.thymeleaf.TemplateEngine engine, java.util.Locale locale, java.util.Map<java.lang.String,java.lang.Object> dataModel, MediaType mediaType)
templateName
- The Thymeleaf template's name. The actual template is
retrieved using the Thymeleaf configuration.engine
- The template engine.locale
- The locale of the template.dataModel
- The Thymeleaf template's data model.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, org.thymeleaf.TemplateEngine engine, java.util.Locale locale, MediaType mediaType)
templateName
- The Thymeleaf template's name. The full path is resolved by
the configuration.locale
- The locale of the templatemediaType
- The representation's media type.public TemplateRepresentation(TemplateRepresentation templateRepresentation, java.util.Locale locale, MediaType mediaType) throws java.io.IOException
templateRepresentation
- The representation to 'decode'.locale
- The locale of the template.mediaType
- The representation's media type.java.io.IOException
ParseErrorException
ResourceNotFoundException
public TemplateRepresentation(TemplateRepresentation templateRepresentation, org.thymeleaf.TemplateEngine engine, java.util.Locale locale, MediaType mediaType) throws java.io.IOException
templateRepresentation
- The representation to 'decode'.engine
- The template engine.locale
- The locale of the template.mediaType
- The representation's media type.java.io.IOException
ParseErrorException
ResourceNotFoundException
public static org.thymeleaf.TemplateEngine createTemplateEngine()
TemplateEngine
based by default on a
TemplateResolver
returned by calling
createTemplateResolver()
.TemplateEngine
public static org.thymeleaf.TemplateEngine createTemplateEngine(org.thymeleaf.templateresolver.ITemplateResolver resolver)
TemplateEngine
based by default on a
TemplateResolver
returned by calling
createTemplateResolver()
.TemplateEngine
public static org.thymeleaf.templateresolver.ITemplateResolver createTemplateResolver()
ITemplateResolver
with default
configuration (XHTML template model, templates located inside
"/WEB-INF/templates/", suffixed by ".html".ITemplateResolver
.public java.util.Locale getLocale()
public java.lang.String getTemplateName()
protected void setContext(org.thymeleaf.context.IContext context)
context
- The Thymeleaf contextpublic void setDataModel(java.util.Map<java.lang.String,java.lang.Object> dataModel)
dataModel
- The template's data model.public void setDataModel(Request request, Response response)
request
- The request where data are located.response
- The response where data are located.Resolver
,
Resolver.createResolver(Request, Response)
public void setDataModel(Resolver<java.lang.Object> resolver)
resolver
- The resolver.public void setTemplateName(java.lang.String templateName)
templateName
- The template's name.public void write(java.io.Writer writer) throws java.io.IOException
write
in class Representation
writer
- The writer to use when writing.java.io.IOException
Copyright © 2005-2020 Restlet.