org.restlet.ext.freemarker
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.freemarker.TemplateRepresentation

public class TemplateRepresentation
extends OutputRepresentation

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

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

Field Summary
 
Fields inherited from class org.restlet.resource.Variant
UNKNOWN_SIZE
 
Constructor Summary
TemplateRepresentation(String templateName, Configuration config, Object dataModel, MediaType mediaType)
          Constructor.
 
Method Summary
 Object getDataModel()
          Returns the template's data model.
 Object setDataModel(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,
                              Configuration config,
                              Object dataModel,
                              MediaType mediaType)
Constructor.

Parameters:
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.
Method Detail

getDataModel

public Object getDataModel()
Returns the template's data model.

Returns:
The template's data model.

setDataModel

public Object setDataModel(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 Technologies.