public class ResponseCtx extends Object
Constructor and Description |
---|
ResponseCtx(Result result)
Constructor that creates a new
ResponseCtx with only a
single Result (a common case). |
ResponseCtx(Set results)
Constructor that creates a new
ResponseCtx with a
Set of Result s. |
Modifier and Type | Method and Description |
---|---|
void |
encode(OutputStream output)
Encodes this context into its XML representation and writes this
encoding to the given
OutputStream with no
indentation. |
void |
encode(OutputStream output,
Indenter indenter)
Encodes this context into its XML representation and writes
this encoding to the given
OutputStream with
indentation. |
void |
encode(OutputStream output,
Indenter indenter,
String nsURI) |
static ResponseCtx |
getInstance(InputStream input)
Creates a new
ResponseCtx by parsing XML from an
input stream. |
static ResponseCtx |
getInstance(Node root)
Creates a new instance of
ResponseCtx based on the given
DOM root node. |
Set |
getResults()
Get the set of
Result s from this response. |
public ResponseCtx(Result result)
ResponseCtx
with only a
single Result
(a common case).result
- the single result in the responsepublic ResponseCtx(Set results)
ResponseCtx
with a
Set
of Result
s. The Set
must
be non-empty.results
- a Set
of Result
objectspublic static ResponseCtx getInstance(Node root) throws ParsingException
ResponseCtx
based on the given
DOM root node. A ParsingException
is thrown if the DOM
root doesn't represent a valid ResponseType.root
- the DOM root of a ResponseTypeResponseCtx
ParsingException
- if the node is invalidpublic static ResponseCtx getInstance(InputStream input) throws ParsingException
ResponseCtx
by parsing XML from an
input stream. Note that this is a convenience method, and it will
not do schema validation by default. You should be parsing the data
yourself, and then providing the root node to the other
getInstance
method. If you use this convenience
method, you probably want to turn on validation by setting the
context schema file (see the programmer guide for more information
on this).input
- a stream providing the XML dataResponseCtx
ParserException
- if there is an error parsing the inputParsingException
public Set getResults()
Result
s from this response.Set
of resultspublic void encode(OutputStream output)
OutputStream
with no
indentation.output
- a stream into which the XML-encoded data is writtenpublic void encode(OutputStream output, Indenter indenter)
OutputStream
with
indentation.output
- a stream into which the XML-encoded data is writtenindenter
- an object that creates indentation stringspublic void encode(OutputStream output, Indenter indenter, String nsURI)
Copyright © 2023 JBoss by Red Hat. All rights reserved.