|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.CharacterRepresentation
org.restlet.representation.WriterRepresentation
org.restlet.ext.xml.TransformRepresentation
public class TransformRepresentation
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, 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.
Field Summary |
---|
Fields inherited from class org.restlet.representation.Representation |
---|
UNKNOWN_SIZE |
Constructor Summary | |
---|---|
TransformRepresentation(Context context,
Representation source,
Representation transformSheet)
Constructor. |
|
TransformRepresentation(Representation source,
Representation transformSheet)
Default constructor. |
|
TransformRepresentation(URIResolver uriResolver,
Representation source,
Representation transformSheet)
Constructor. |
|
TransformRepresentation(URIResolver uriResolver,
Representation source,
Templates templates)
Constructor. |
Method Summary | |
---|---|
ErrorListener |
getErrorListener()
Returns the transformer's error listener. |
Map<String,String> |
getOutputProperties()
Returns the modifiable map of JAXP transformer output properties. |
Map<String,Object> |
getParameters()
Returns the modifiable map of JAXP transformer parameters. |
SAXSource |
getSaxSource()
Returns the SAX source associated to the source representation. |
Representation |
getSourceRepresentation()
Returns the source representation to transform. |
Templates |
getTemplates()
Returns the templates to be used and reused. |
Transformer |
getTransformer()
Returns a new transformer to be used. |
TransformerHandler |
getTransformerHandler()
Returns the SAX transformer handler associated to the transform sheet. |
Representation |
getTransformSheet()
Returns the XSLT transform sheet to apply to the source representation. |
URIResolver |
getUriResolver()
Returns the URI resolver. |
XMLFilter |
getXmlFilter()
Returns the SAX XML filter applying the transform sheet to its input. |
void |
release()
Releases the source and transform sheet representations, the transformer and the URI resolver. |
void |
setErrorListener(ErrorListener errorListener)
Sets the transformer's error listener. |
void |
setOutputProperties(Map<String,String> outputProperties)
Sets the modifiable map of JAXP transformer output properties. |
void |
setParameters(Map<String,Object> parameters)
Sets the JAXP transformer parameters. |
void |
setSourceRepresentation(Representation source)
Sets the source representation to transform. |
void |
setTemplates(Templates templates)
Sets the templates to be used and reused. |
void |
setTransformSheet(Representation transformSheet)
Sets the XSLT transform sheet to apply to message entities. |
void |
setUriResolver(URIResolver uriResolver)
Sets the URI resolver. |
static SAXSource |
toSaxSource(Representation representation)
Wraps a source representation into a SAXSource . |
void |
transform(Source source,
Result result)
Transforms the given JAXP source into the given result. |
void |
write(Result result)
Writes the transformed source into the given JAXP result. |
void |
write(Writer writer)
Writes the transformed source into the given output stream. |
Methods inherited from class org.restlet.representation.WriterRepresentation |
---|
getReader |
Methods inherited from class org.restlet.representation.CharacterRepresentation |
---|
getChannel, getStream, write, write |
Methods inherited from class org.restlet.representation.Representation |
---|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient |
Methods inherited from class org.restlet.representation.RepresentationInfo |
---|
getModificationDate, getTag, setModificationDate, setTag |
Methods inherited from class org.restlet.representation.Variant |
---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TransformRepresentation(Context context, Representation source, Representation transformSheet)
context
- The parent context.source
- The source representation to transform.transformSheet
- The XSLT transform sheet to apply.public TransformRepresentation(Representation source, Representation transformSheet)
source
- The source representation to transform.transformSheet
- The XSLT transform sheet to apply.public TransformRepresentation(URIResolver uriResolver, Representation source, Representation transformSheet)
uriResolver
- The JAXP URI resolver.source
- The source representation to transform.transformSheet
- The XSLT transform sheet to apply.public TransformRepresentation(URIResolver uriResolver, Representation source, Templates templates)
uriResolver
- The optional JAXP URI resolver.source
- The source representation to transform.templates
- The precompiled JAXP template.Method Detail |
---|
public static SAXSource toSaxSource(Representation representation) throws IOException
SAXSource
. This method can
detect other XmlRepresentation
instances to use their
XmlRepresentation.getSaxSource()
method as well as other
TransformRepresentation
instances to support transformation
chaining.
representation
- The source representation.
IOException
public ErrorListener getErrorListener()
public Map<String,String> getOutputProperties()
public Map<String,Object> getParameters()
public SAXSource getSaxSource() throws IOException
IOException
public Representation getSourceRepresentation()
public Templates getTemplates() throws IOException
IOException
public Transformer getTransformer() throws IOException
getTemplates()
.newTransformer() method.
IOException
public TransformerHandler getTransformerHandler() throws IOException
IOException
public Representation getTransformSheet()
public URIResolver getUriResolver()
public XMLFilter getXmlFilter() throws IOException
IOException
public void release()
release
in class Representation
public void setErrorListener(ErrorListener errorListener)
errorListener
- The transformer's error listener.public void setOutputProperties(Map<String,String> outputProperties)
outputProperties
- The JAXP transformer output properties.public void setParameters(Map<String,Object> parameters)
parameters
- The JAXP transformer parameters.public void setSourceRepresentation(Representation source)
source
- The source representation to transform.public void setTemplates(Templates templates)
templates
- The templates to be used and reused.public void setTransformSheet(Representation transformSheet)
transformSheet
- The XSLT transform sheet to apply to message entities.public void setUriResolver(URIResolver uriResolver)
uriResolver
- The URI resolver.public void transform(Source source, Result result) throws IOException
source
- The JAXP source object.result
- The JAXP result object.
IOException
public void write(Result result) throws IOException
getSaxSource()
method.
result
- The JAXP result object.
IOException
public void write(Writer writer) throws IOException
write(Result)
method using a
StreamResult
object.
write
in class Representation
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |