public class TemplateRepresentation extends WriterRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
TemplateRepresentation(Representation templateRepresentation,
freemarker.template.Configuration config,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
freemarker.template.Configuration config,
java.lang.Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
java.lang.Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
freemarker.template.Configuration config,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
freemarker.template.Configuration config,
java.lang.Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(freemarker.template.Template template,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(freemarker.template.Template template,
java.lang.Object dataModel,
MediaType mediaType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getDataModel()
Returns the template's data model.
|
freemarker.template.Template |
getTemplate()
Returns the FreeMarker template.
|
static freemarker.template.Template |
getTemplate(freemarker.template.Configuration config,
Representation templateRepresentation)
Returns a FreeMarker template from a representation and a configuration.
|
static freemarker.template.Template |
getTemplate(freemarker.template.Configuration config,
java.lang.String templateName)
Returns a FreeMarker template from its name and a configuration.
|
java.lang.Object |
setDataModel(java.lang.Object dataModel)
Sets the template's data model.
|
java.lang.Object |
setDataModel(Request request,
Response response)
Sets the template's data model from a request/response pair.
|
java.lang.Object |
setDataModel(Resolver<java.lang.Object> resolver)
Sets the template's data model from a resolver.
|
void |
setTemplate(freemarker.template.Template template)
Sets the FreeMarker template.
|
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
public TemplateRepresentation(Representation templateRepresentation, freemarker.template.Configuration config, MediaType mediaType)
templateRepresentation
- The FreeMarker template provided via a representation.config
- The FreeMarker configuration.mediaType
- The representation's media type.public TemplateRepresentation(Representation templateRepresentation, freemarker.template.Configuration config, java.lang.Object dataModel, MediaType mediaType)
templateRepresentation
- The FreeMarker template provided via a representation.config
- The FreeMarker configuration.dataModel
- The template's data model.mediaType
- The representation's media type.public TemplateRepresentation(Representation templateRepresentation, MediaType mediaType)
templateRepresentation
- The FreeMarker template provided via a representation.mediaType
- The representation's media type.public TemplateRepresentation(Representation templateRepresentation, java.lang.Object dataModel, MediaType mediaType)
templateRepresentation
- The FreeMarker template provided via a representation.dataModel
- The template's data model.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, freemarker.template.Configuration config, MediaType mediaType)
templateName
- The FreeMarker template's name. The full path is resolved by
the configuration.config
- The FreeMarker configuration.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, freemarker.template.Configuration config, java.lang.Object dataModel, MediaType mediaType)
templateName
- The FreeMarker template's name. The full path is resolved by
the configuration.config
- The FreeMarker configuration.dataModel
- The template's data model.mediaType
- The representation's media type.public TemplateRepresentation(freemarker.template.Template template, MediaType mediaType)
template
- The FreeMarker template.mediaType
- The representation's media type.public TemplateRepresentation(freemarker.template.Template template, java.lang.Object dataModel, MediaType mediaType)
template
- The FreeMarker template.dataModel
- The template's data model.mediaType
- The representation's media type.public static freemarker.template.Template getTemplate(freemarker.template.Configuration config, Representation templateRepresentation)
config
- The FreeMarker configuration.templateRepresentation
- The template representation.public static freemarker.template.Template getTemplate(freemarker.template.Configuration config, java.lang.String templateName)
config
- The FreeMarker configuration.templateName
- The template name.public java.lang.Object getDataModel()
public freemarker.template.Template getTemplate()
public java.lang.Object setDataModel(java.lang.Object dataModel)
dataModel
- The template's data model.public java.lang.Object 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 java.lang.Object setDataModel(Resolver<java.lang.Object> resolver)
resolver
- The resolver.public void setTemplate(freemarker.template.Template template)
template
- The FreeMarker template.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-2024 Restlet.