public class TemplateRepresentation extends WriterRepresentation
UNKNOWN_SIZE| Constructor and Description |
|---|
TemplateRepresentation(Representation templateRepresentation,
Map<String,Object> dataModel,
MediaType mediaType)
Constructor based on a Velocity 'encoded' representation.
|
TemplateRepresentation(Representation templateRepresentation,
MediaType mediaType)
Constructor based on a Velocity 'encoded' representation.
|
TemplateRepresentation(String templateName,
Map<String,Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(String templateName,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(org.apache.velocity.Template template,
Map<String,Object> dataModel,
MediaType mediaType)
Constructor.
|
TemplateRepresentation(org.apache.velocity.Template template,
MediaType mediaType)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.velocity.app.VelocityEngine |
getEngine()
Returns the Velocity engine.
|
org.apache.velocity.Template |
getTemplate()
Returns the Velocity template.
|
void |
setDataModel(Map<String,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<Object> resolver)
Sets the template's data model from a resolver.
|
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, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toStringpublic TemplateRepresentation(Representation templateRepresentation, Map<String,Object> dataModel, MediaType mediaType) throws org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, IOException
templateRepresentation - The representation to 'decode'.dataModel - The Velocity template's data model.mediaType - The representation's media type.IOExceptionorg.apache.velocity.exception.ParseErrorExceptionorg.apache.velocity.exception.ResourceNotFoundExceptionpublic TemplateRepresentation(Representation templateRepresentation, MediaType mediaType) throws org.apache.velocity.exception.ResourceNotFoundException, org.apache.velocity.exception.ParseErrorException, IOException
templateRepresentation - The representation to 'decode'.mediaType - The representation's media type.IOExceptionorg.apache.velocity.exception.ParseErrorExceptionorg.apache.velocity.exception.ResourceNotFoundExceptionpublic TemplateRepresentation(String templateName, Map<String,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(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(org.apache.velocity.Template template,
Map<String,Object> dataModel,
MediaType mediaType)
template - The Velocity template.dataModel - The Velocity template's data model.mediaType - The representation's media type.public TemplateRepresentation(org.apache.velocity.Template template,
MediaType mediaType)
template - The Velocity template.mediaType - The representation's media type.public org.apache.velocity.app.VelocityEngine getEngine()
public org.apache.velocity.Template getTemplate()
public void setDataModel(Map<String,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<Object> resolver)
resolver - The resolver.public void write(Writer writer) throws IOException
write in class Representationwriter - The writer to use when writing.IOExceptionCopyright © 2005–2015. All rights reserved.