org.restlet.resource
Class TransformRepresentation

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.resource.TransformRepresentation

public class TransformRepresentation
extends OutputRepresentation

Representation able to apply an XSLT transformation. The internal JAXP transformer is created when the getTransformer() method is first called. So, if you need to specify a custom URI resolver, you need to do it before actually using the representation for a transformation.

This representation should be viewed as a wrapper representation that applies a transform sheet on a source representation when it is read or written out. Therefore, it isn't intended to be reused on different sources. For this use case, you should instead use the Transformer filter.

Author:
Jerome Louvel (contact@noelios.com) Noelios Technologies

Field Summary
 
Fields inherited from class org.restlet.resource.Variant
UNKNOWN_SIZE
 
Constructor Summary
TransformRepresentation(Context context, Representation source, Representation transformSheet)
          Constructor.
 
Method Summary
 Representation getSourceRepresentation()
          Returns the source representation to transform.
 Transformer getTransformer()
          Returns the transformer to be used and reused.
 Representation getTransformSheet()
          Returns the XSLT transform sheet to apply to the source representation.
 URIResolver getURIResolver()
          Returns the URI resolver.
 void setTransformSheet(Representation transformSheet)
          Sets the XSLT transform sheet to apply to message entities.
 void write(OutputStream outputStream)
          Writes the representation to a byte stream.
 
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

TransformRepresentation

public TransformRepresentation(Context context,
                               Representation source,
                               Representation transformSheet)
Constructor.

Parameters:
context - The parent context.
source - The source representation to transform.
transformSheet - The XSLT transform sheet.
Method Detail

getSourceRepresentation

public Representation getSourceRepresentation()
Returns the source representation to transform.

Returns:
The source representation to transform.

getTransformer

public Transformer getTransformer()
                           throws IOException
Returns the transformer to be used and reused.

Returns:
The transformer to be used and reused.
Throws:
IOException

getTransformSheet

public Representation getTransformSheet()
Returns the XSLT transform sheet to apply to the source representation.

Returns:
The XSLT transform sheet to apply.

getURIResolver

public URIResolver getURIResolver()
Returns the URI resolver.

Returns:
The URI resolver.

setTransformSheet

public void setTransformSheet(Representation transformSheet)
Sets the XSLT transform sheet to apply to message entities.

Parameters:
transformSheet - The XSLT transform sheet to apply to message entities.

write

public void write(OutputStream outputStream)
           throws IOException
Description copied from class: OutputRepresentation
Writes the representation to a byte stream.

Specified by:
write in class OutputRepresentation
Parameters:
outputStream - The output stream.
Throws:
IOException


Copyright © 2005-2007 Noelios Technologies.