org.apache.xmlrpc
Class XmlRpcClientResponseProcessor

java.lang.Object
  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.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.xmlrpc.XmlRpc
XmlRpc.Value
 
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(java.io.InputStream 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

result

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


fault

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

Constructor Detail

XmlRpcClientResponseProcessor

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

Method Detail

decodeResponse

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

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

decodeException

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

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

objectParsed

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

startElement

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
Overrides:
startElement in class XmlRpc
Parameters:
name - The element type name.
atts - The specified or defaulted attributes.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)

canReUse

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.

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


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