public abstract class NodeContentProducer extends Object implements ContentProducer
Clients may subclass this class.
Constructor and Description |
---|
NodeContentProducer() |
Modifier and Type | Method and Description |
---|---|
InputStream |
getContents(Map<?,?> options)
Returns the underlying content as a stream, either in XML or JSON format.
|
protected abstract void |
write(NodeWriter writer,
Map<?,?> options)
Implementation must call methods on the specified
NodeWriter to build a node tree that is later serialized either as JSON or XML
format. |
public InputStream getContents(Map<?,?> options) throws IOException, UnsupportedOperationException
The options configures the content to retrieve. Options must include a "Content-Type"
property to determine the format of data to
retrieve, which is either one of the following: "application/json"
, "application/xml"
or "text/xml"
.
getContents
in interface ContentProducer
options
- properties describing the content to retrieve.IOException
- if the content cannot be read.UnsupportedOperationException
- if the "Content-Type"
property is missing or
is neither one of the following: "application/json"
, "application/xml"
or "text/xml"
.protected abstract void write(NodeWriter writer, Map<?,?> options) throws IOException
NodeWriter
to build a node tree that is later serialized either as JSON or XML
format.writer
- the node writer on which nodes creation is requested.options
- properties describing the content to retrieve.IOException
- if the nodes cannot be produced.