public class TemplateRepresentation extends WriterRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
TemplateRepresentation(Representation templateRepresentation,
Configuration config,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
Configuration config,
Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Representation templateRepresentation,
Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(String templateName,
Configuration config,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(String templateName,
Configuration config,
Object dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Template template,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Template template,
Object dataModel,
MediaType mediaType)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
getDataModel()
Returns the template's data model.
|
Template |
getTemplate()
Returns the FreeMarker template.
|
static Template |
getTemplate(Configuration config,
Representation templateRepresentation)
Returns a FreeMarker template from a representation and a configuration.
|
static Template |
getTemplate(Configuration config,
String templateName)
Returns a FreeMarker template from its name and a configuration.
|
Object |
setDataModel(Object dataModel)
Sets the template's data model.
|
Object |
setDataModel(Request request,
Response response)
Sets the template's data model from a request/response pair.
|
Object |
setDataModel(Resolver<Object> resolver)
Sets the template's data model from a resolver.
|
void |
setTemplate(Template template)
Sets the FreeMarker template.
|
void |
write(Writer writer)
Writes the datum as a stream of characters.
|
getReadergetChannel, getStream, write, writeappend, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransientgetModificationDate, getTag, setModificationDate, setTagcreateClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, hashCode, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toStringpublic TemplateRepresentation(Representation templateRepresentation, 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, Configuration config, 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, 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(String templateName, 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(String templateName, Configuration config, 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(Template template, MediaType mediaType)
template - The FreeMarker template.mediaType - The representation's media type.public static Template getTemplate(Configuration config, Representation templateRepresentation)
config - The FreeMarker configuration.templateRepresentation - The template representation.public static Template getTemplate(Configuration config, String templateName)
config - The FreeMarker configuration.templateName - The template name.public Object getDataModel()
public Template getTemplate()
public Object setDataModel(Object dataModel)
dataModel - The template's data model.public 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 Object setDataModel(Resolver<Object> resolver)
resolver - The resolver.public void setTemplate(Template template)
template - The FreeMarker template.public void write(Writer writer) throws IOException
write in class Representationwriter - The writer to use when writing.IOExceptionCopyright © 2005-2017 Restlet.