public class TemplateRepresentation extends WriterRepresentation
UNKNOWN_SIZE
Constructor and Description |
---|
TemplateRepresentation(Representation templateRepresentation,
java.util.Map<java.lang.String,java.lang.Object> dataModel,
MediaType mediaType)
Constructor based on a Velocity 'encoded' representation.
|
TemplateRepresentation(Representation templateRepresentation,
MediaType mediaType)
Constructor based on a Velocity 'encoded' representation.
|
TemplateRepresentation(java.lang.String templateName,
java.util.Map<java.lang.String,java.lang.Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(java.lang.String templateName,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Template template,
java.util.Map<java.lang.String,java.lang.Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(Template template,
MediaType mediaType)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
VelocityEngine |
getEngine()
Returns the Velocity engine.
|
Template |
getTemplate()
Returns the Velocity template.
|
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 |
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, java.util.Map<java.lang.String,java.lang.Object> dataModel, MediaType mediaType) throws ResourceNotFoundException, ParseErrorException, java.io.IOException
templateRepresentation
- The representation to 'decode'.dataModel
- The Velocity template's data model.mediaType
- The representation's media type.java.io.IOException
ParseErrorException
ResourceNotFoundException
public TemplateRepresentation(Representation templateRepresentation, MediaType mediaType) throws ResourceNotFoundException, ParseErrorException, java.io.IOException
templateRepresentation
- The representation to 'decode'.mediaType
- The representation's media type.java.io.IOException
ParseErrorException
ResourceNotFoundException
public TemplateRepresentation(java.lang.String templateName, java.util.Map<java.lang.String,java.lang.Object> dataModel, MediaType mediaType)
templateName
- The Velocity template's name. The actual template is retrieved
using the Velocity configuration.dataModel
- The Velocity template's data model.mediaType
- The representation's media type.public TemplateRepresentation(java.lang.String templateName, MediaType mediaType)
templateName
- The Velocity template's name. The full path is resolved by the
configuration.mediaType
- The representation's media type.public TemplateRepresentation(Template template, java.util.Map<java.lang.String,java.lang.Object> dataModel, MediaType mediaType)
template
- The Velocity template.dataModel
- The Velocity template's data model.mediaType
- The representation's media type.public VelocityEngine getEngine()
public Template getTemplate()
public 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 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.