org.apache.xmlrpc.parser
Class XmlRpcResponseParser
java.lang.Object
org.apache.xmlrpc.parser.TypeParserImpl
org.apache.xmlrpc.parser.RecursiveTypeParserImpl
org.apache.xmlrpc.parser.XmlRpcResponseParser
- All Implemented Interfaces:
- TypeParser, org.xml.sax.ContentHandler
public class XmlRpcResponseParser
- extends RecursiveTypeParserImpl
A SAX parser for an org.apache.xmlrpc.server.XmlRpcServer
's
response.
Method Summary |
protected void |
addResult(java.lang.Object pResult)
|
void |
endElement(java.lang.String pURI,
java.lang.String pLocalName,
java.lang.String pQName)
|
java.lang.Throwable |
getErrorCause()
If the response contained a fault, returns the (optional)
exception. |
int |
getErrorCode()
If the response contained a fault, returns the error code. |
java.lang.String |
getErrorMessage()
If the response contained a fault, returns the error message. |
boolean |
isSuccess()
Returns whether the response returned success. |
void |
startDocument()
|
void |
startElement(java.lang.String pURI,
java.lang.String pLocalName,
java.lang.String pQName,
org.xml.sax.Attributes pAttrs)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
level
private int level
isSuccess
private boolean isSuccess
errorCode
private int errorCode
errorMessage
private java.lang.String errorMessage
errorCause
private java.lang.Throwable errorCause
XmlRpcResponseParser
public XmlRpcResponseParser(XmlRpcStreamRequestConfig pConfig,
TypeFactory pTypeFactory)
- Creates a new instance.
- Parameters:
pConfig
- The response configuration.pTypeFactory
- The type factory for creating instances of
TypeParser
.
addResult
protected void addResult(java.lang.Object pResult)
throws org.xml.sax.SAXException
- Specified by:
addResult
in class RecursiveTypeParserImpl
- Throws:
org.xml.sax.SAXException
startDocument
public void startDocument()
throws org.xml.sax.SAXException
- Specified by:
startDocument
in interface org.xml.sax.ContentHandler
- Overrides:
startDocument
in class RecursiveTypeParserImpl
- Throws:
org.xml.sax.SAXException
startElement
public void startElement(java.lang.String pURI,
java.lang.String pLocalName,
java.lang.String pQName,
org.xml.sax.Attributes pAttrs)
throws org.xml.sax.SAXException
- Specified by:
startElement
in interface org.xml.sax.ContentHandler
- Overrides:
startElement
in class RecursiveTypeParserImpl
- Throws:
org.xml.sax.SAXException
endElement
public void endElement(java.lang.String pURI,
java.lang.String pLocalName,
java.lang.String pQName)
throws org.xml.sax.SAXException
- Specified by:
endElement
in interface org.xml.sax.ContentHandler
- Overrides:
endElement
in class RecursiveTypeParserImpl
- Throws:
org.xml.sax.SAXException
isSuccess
public boolean isSuccess()
- Returns whether the response returned success. If so, the
result object may be fetched using
TypeParserImpl.getResult()
.
Otherwise, you may use the methods
getErrorCode()
and getErrorMessage()
to
check for error reasons.
- Returns:
- True, if the response indicated success, false otherwise.
getErrorCode
public int getErrorCode()
- If the response contained a fault, returns the error code.
- Returns:
- The numeric error code.
getErrorMessage
public java.lang.String getErrorMessage()
- If the response contained a fault, returns the error message.
- Returns:
- The error message.
getErrorCause
public java.lang.Throwable getErrorCause()
- If the response contained a fault, returns the (optional)
exception.