org.restlet.ext.velocity
Class TemplateRepresentation

java.lang.Object
  extended by org.restlet.resource.Variant
      extended by org.restlet.resource.Representation
          extended by org.restlet.resource.StreamRepresentation
              extended by org.restlet.resource.OutputRepresentation
                  extended by org.restlet.ext.velocity.TemplateRepresentation

public class TemplateRepresentation
extends OutputRepresentation

Velocity template representation. Useful for dynamic string-based representations.

Author:
Jerome Louvel (contact@noelios.com)
See Also:
Velocity home page

Field Summary
 
Fields inherited from class org.restlet.resource.Variant
UNKNOWN_SIZE
 
Constructor Summary
TemplateRepresentation(String templateName, Map<String,Object> dataModel, MediaType mediaType)
          Constructor.
TemplateRepresentation(String templateName, MediaType mediaType)
          Constructor.
 
Method Summary
 Map<String,Object> getDataModel()
          Returns the template's data model.
 org.apache.velocity.app.VelocityEngine getEngine()
          Returns the Velocity engine.
 Map<String,Object> setDataModel(Map<String,Object> dataModel)
          Sets the template's data model.
 void write(OutputStream outputStream)
          Writes the datum as a stream of bytes.
 
Methods inherited from class org.restlet.resource.OutputRepresentation
getStream
 
Methods inherited from class org.restlet.resource.StreamRepresentation
getChannel, write
 
Methods inherited from class org.restlet.resource.Representation
getText, isAvailable, isTransient, setAvailable, setTransient
 
Methods inherited from class org.restlet.resource.Variant
getCharacterSet, getEncodings, getExpirationDate, getIdentifier, getLanguages, getMediaType, getModificationDate, getSize, getTag, setCharacterSet, setExpirationDate, setIdentifier, setIdentifier, setMediaType, setModificationDate, setSize, setTag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateRepresentation

public TemplateRepresentation(String templateName,
                              MediaType mediaType)
Constructor.

Parameters:
templateName - The Velocity template's name. The full path is resolved by the configuration.
mediaType - The representation's media type.

TemplateRepresentation

public TemplateRepresentation(String templateName,
                              Map<String,Object> dataModel,
                              MediaType mediaType)
Constructor.

Parameters:
templateName - The Velocity template's name. The full path is resolved by the configuration.
dataModel - The Velocity template's data model.
mediaType - The representation's media type.
Method Detail

getEngine

public org.apache.velocity.app.VelocityEngine getEngine()
Returns the Velocity engine.

Returns:
The Velocity engine.

getDataModel

public Map<String,Object> getDataModel()
Returns the template's data model.

Returns:
The template's data model.

setDataModel

public Map<String,Object> setDataModel(Map<String,Object> dataModel)
Sets the template's data model.

Parameters:
dataModel - The template's data model.
Returns:
The template's data model.

write

public void write(OutputStream outputStream)
           throws IOException
Writes the datum as a stream of bytes.

Specified by:
write in class OutputRepresentation
Parameters:
outputStream - The stream to use when writing.
Throws:
IOException


Copyright © 2005-2007 Noelios Consulting.