Class XmlRpcClientResponseProcessor

  extended by org.xml.sax.HandlerBase
      extended by org.apache.xmlrpc.XmlRpc
          extended by org.apache.xmlrpc.XmlRpcClientResponseProcessor
All Implemented Interfaces:
DocumentHandler, DTDHandler, EntityResolver, ErrorHandler

public class XmlRpcClientResponseProcessor
extends XmlRpc

Process an XML-RPC server response from a byte array or an InputStream into an Object. Optionally throw the result object if it is an exception.

$Id: XmlRpcClientResponseProcessor.html 359531 2005-12-28 13:59:25Z jochen $
Hannes Wallnoefer, Andrew Evers

Nested Class Summary
Nested classes/interfaces inherited from class org.apache.xmlrpc.XmlRpc
Field Summary
protected  boolean fault
          Set to true if a fault occured on the server.
protected  java.lang.Object result
          The result of the XML-RPC operation.
Fields inherited from class org.apache.xmlrpc.XmlRpc
ARRAY, BASE64, BOOLEAN, cdata, currentValue, DATE, debug, defaultInputEncoding, DOUBLE, encoding, errorLevel, errorMsg, FATAL, INTEGER, keepalive, methodName, NONE, readCdata, RECOVERABLE, STRING, STRUCT, types, tz, values, version
Constructor Summary
XmlRpcClientResponseProcessor(java.util.TimeZone tz)
          Creates a new instance.
Method Summary
protected  boolean canReUse()
          Called by the worker management framework to see if this worker can be re-used.
protected  XmlRpcException decodeException(java.lang.Object result)
          Decode an exception from the result returned from the remote server.
 java.lang.Object decodeResponse( is)
          Decode an XML-RPC response from the specified InputStream.
protected  void objectParsed(java.lang.Object what)
          This method is called when a root level object has been parsed.
 void startElement(java.lang.String name, AttributeList atts)
          Overrides method in XmlRpc to handle fault repsonses.
Methods inherited from class org.apache.xmlrpc.XmlRpc
characters, endElement, error, fatalError, getDefaultInputEncoding, getEncoding, getInputEncoding, getKeepAlive, getMaxThreads, getServerTimeZone, parse, setDebug, setDefaultInputEncoding, setDriver, setDriver, setEncoding, setInputEncoding, setKeepAlive, setMaxThreads, setServerTimeZone
Methods inherited from class org.xml.sax.HandlerBase
endDocument, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, startDocument, unparsedEntityDecl, warning
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


protected java.lang.Object result
The result of the XML-RPC operation. Possibly an XmlRpcException


protected boolean fault
Set to true if a fault occured on the server.

Constructor Detail


public XmlRpcClientResponseProcessor(java.util.TimeZone tz)
Creates a new instance.

Method Detail


public java.lang.Object decodeResponse( is)
                                throws XmlRpcClientException
Decode an XML-RPC response from the specified InputStream.

is - The stream from which to read the response.
The response, which will be a XmlRpcException if an error occured.


protected XmlRpcException decodeException(java.lang.Object result)
                                   throws XmlRpcClientException
Decode an exception from the result returned from the remote server. This method both returns and throws an XmlRpcException. If it returns an XmlRpcException then that is the exception thrown on the remote side. If it throws an exception then an exception occured locally when decoding the response

result - The response from the remote XML-RPC server.
A XmlRpcException describing the error which occurred.
XmlRpcClientException - if the result could not be processed.


protected void objectParsed(java.lang.Object what)
Description copied from class: XmlRpc
This method is called when a root level object has been parsed. Sub-classes implement this callback to receive the fully parsed object.

Specified by:
objectParsed in class XmlRpc


public void startElement(java.lang.String name,
                         AttributeList atts)
                  throws SAXException
Overrides method in XmlRpc to handle fault repsonses.

Specified by:
startElement in interface DocumentHandler
startElement in class XmlRpc
name - The element type name.
atts - The specified or defaulted attributes.
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)


protected boolean canReUse()
Called by the worker management framework to see if this worker can be re-used. Must attempt to clean up any state, and return true if it can be re-used.

boolean true if this worker has been cleaned up and may be re-used.

Copyright 2001-2001-2005 Apache Software Foundation. All Rights Reserved.