org.apache.xmlrpc

Class XmlRpcClientResponseProcessor


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.
Version:
$Id: XmlRpcClientResponseProcessor.java 350048 2005-11-30 21:49:32 +0100 (Mi, 30 Nov 2005) jochen $
Authors:
Hannes Wallnoefer
Andrew Evers
Since:
2.0

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 Object
result
The result of the XML-RPC operation.

Fields inherited from class org.apache.xmlrpc.XmlRpc

ARRAY, BASE64, BOOLEAN, DATE, DEFAULT_PARSER, DOUBLE, FATAL, INTEGER, NONE, RECOVERABLE, STRING, STRUCT, cdata, currentValue, debug, defaultInputEncoding, encoding, errorLevel, errorMsg, inputEncoding, keepalive, maxThreads, methodName, parserClass, readCdata, saxDrivers, typeFactory, types, tz, values, version

Constructor Summary

XmlRpcClientResponseProcessor(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(Object result)
Decode an exception from the result returned from the remote server.
Object
decodeResponse(InputStream is)
Decode an XML-RPC response from the specified InputStream.
protected void
objectParsed(Object what)
void
startElement(String name, org.xml.sax.AttributeList atts)
Overrides method in XmlRpc to handle fault repsonses.

Methods inherited from class org.apache.xmlrpc.XmlRpc

characters, createTypeFactory, endElement, error, fatalError, getDefaultInputEncoding, getEncoding, getInputEncoding, getKeepAlive, getMaxThreads, getServerTimeZone, objectParsed, parse, setDebug, setDefaultInputEncoding, setDriver, setDriver, setEncoding, setInputEncoding, setKeepAlive, setMaxThreads, setServerTimeZone, startElement

Field Details

fault

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

result

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

Constructor Details

XmlRpcClientResponseProcessor

public XmlRpcClientResponseProcessor(TimeZone tz)
Creates a new instance.

Method Details

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.

decodeException

protected XmlRpcException decodeException(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.

decodeResponse

public Object decodeResponse(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.

objectParsed

protected void objectParsed(Object what)
Overrides:
objectParsed in interface XmlRpc

startElement

public void startElement(String name,
                         org.xml.sax.AttributeList atts)
            throws org.xml.sax.SAXException
Overrides method in XmlRpc to handle fault repsonses.
Overrides:
startElement in interface XmlRpc

Copyright B) 1999-2002 Apache Software Foundation. All Rights Reserved.