org.apache.xmlrpc.applet
Class XmlRpcSupport

java.lang.Object
  extended by org.xml.sax.HandlerBase
      extended by org.apache.xmlrpc.applet.XmlRpcSupport
All Implemented Interfaces:
DocumentHandler, DTDHandler, EntityResolver, ErrorHandler

 class XmlRpcSupport
extends HandlerBase

FIXME: Leverage the XmlRpc class.


Nested Class Summary
(package private)  class XmlRpcSupport.Value
          This represents an XML-RPC Value while the request is being parsed.
(package private)  class XmlRpcSupport.XmlWriter
          A quick and dirty XML writer.
 
Field Summary
(package private) static int ARRAY
           
(package private)  org.apache.commons.codec.binary.Base64 base64
           
(package private) static int BASE64
           
(package private) static int BOOLEAN
           
(package private)  java.lang.StringBuffer cdata
           
(package private)  XmlRpcSupport.Value currentValue
           
(package private) static int DATE
           
static boolean debug
           
(package private) static int DOUBLE
           
(package private)  boolean fault
           
(package private) static java.text.DateFormat format
           
(package private) static int INTEGER
           
(package private)  java.lang.String methodName
           
(package private)  boolean readCdata
           
(package private)  java.lang.Object result
           
(package private) static int STRING
           
(package private) static int STRUCT
           
(package private) static java.lang.String[] types
           
(package private)  java.net.URL url
           
(package private)  java.util.Stack values
           
 
Constructor Summary
XmlRpcSupport(java.net.URL url)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
          Method called by SAX driver.
 void endElement(java.lang.String name)
          Method called by SAX driver.
 void error(SAXParseException e)
          Receive notification of a recoverable parser error.
 java.lang.Object execute(java.lang.String method, java.util.Vector arguments)
          Generate an XML-RPC request and send it to the server.
 void fatalError(SAXParseException e)
          Report a fatal XML parsing error.
(package private)  void objectParsed(java.lang.Object what)
          Called when the return value has been parsed.
(package private)  void parse(java.io.InputStream is)
          Parse the input stream.
static void setDebug(boolean val)
          Switch debugging output on/off.
 void startElement(java.lang.String name, AttributeList atts)
          Method called by SAX driver.
(package private)  void writeObject(java.lang.Object what, XmlRpcSupport.XmlWriter writer)
          Writes the XML representation of a supported Java object to the XML writer.
(package private)  void writeRequest(XmlRpcSupport.XmlWriter writer, java.lang.String method, java.util.Vector params)
          Generate an XML-RPC request from a method name and a parameter vector.
 
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

url

java.net.URL url

methodName

java.lang.String methodName

fault

boolean fault

result

java.lang.Object result

base64

org.apache.commons.codec.binary.Base64 base64

values

java.util.Stack values

currentValue

XmlRpcSupport.Value currentValue

readCdata

boolean readCdata

format

static final java.text.DateFormat format

cdata

java.lang.StringBuffer cdata

STRING

static final int STRING
See Also:
Constant Field Values

INTEGER

static final int INTEGER
See Also:
Constant Field Values

BOOLEAN

static final int BOOLEAN
See Also:
Constant Field Values

DOUBLE

static final int DOUBLE
See Also:
Constant Field Values

DATE

static final int DATE
See Also:
Constant Field Values

BASE64

static final int BASE64
See Also:
Constant Field Values

STRUCT

static final int STRUCT
See Also:
Constant Field Values

ARRAY

static final int ARRAY
See Also:
Constant Field Values

debug

public static boolean debug

types

static final java.lang.String[] types
Constructor Detail

XmlRpcSupport

public XmlRpcSupport(java.net.URL url)
Parameters:
url -
Method Detail

setDebug

public static void setDebug(boolean val)
Switch debugging output on/off.


parse

void parse(java.io.InputStream is)
     throws java.lang.Exception
Parse the input stream. For each root level object, method objectParsed is called.

Throws:
java.lang.Exception

writeObject

void writeObject(java.lang.Object what,
                 XmlRpcSupport.XmlWriter writer)
           throws java.io.IOException
Writes the XML representation of a supported Java object to the XML writer.

Throws:
java.io.IOException

execute

public java.lang.Object execute(java.lang.String method,
                                java.util.Vector arguments)
                         throws XmlRpcException,
                                java.io.IOException
Generate an XML-RPC request and send it to the server. Parse the result and return the corresponding Java object.

Throws:
XmlRpcException - If the remote host returned a fault message.
java.io.IOException - If the call could not be made for lower level problems.

objectParsed

void objectParsed(java.lang.Object what)
Called when the return value has been parsed.


writeRequest

void writeRequest(XmlRpcSupport.XmlWriter writer,
                  java.lang.String method,
                  java.util.Vector params)
            throws java.io.IOException
Generate an XML-RPC request from a method name and a parameter vector.

Throws:
java.io.IOException

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws SAXException
Method called by SAX driver.

Specified by:
characters in interface DocumentHandler
Overrides:
characters in class HandlerBase
Parameters:
ch - The characters.
start - The start position in the character array.
length - The number of characters to use from the character array.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.characters(char[], int, int)

endElement

public void endElement(java.lang.String name)
                throws SAXException
Method called by SAX driver.

Specified by:
endElement in interface DocumentHandler
Overrides:
endElement in class HandlerBase
Parameters:
name - The element type name.
Throws:
SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.endElement(java.lang.String)

startElement

public void startElement(java.lang.String name,
                         AttributeList atts)
                  throws SAXException
Method called by SAX driver.

Specified by:
startElement in interface DocumentHandler
Overrides:
startElement in class HandlerBase
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)

error

public void error(SAXParseException e)
           throws SAXException
Description copied from class: HandlerBase
Receive notification of a recoverable parser error.

The default implementation does nothing. Application writers may override this method in a subclass to take specific actions for each error, such as inserting the message in a log file or printing it to the console.

Specified by:
error in interface ErrorHandler
Overrides:
error in class HandlerBase
Parameters:
e -
Throws:
SAXException
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

fatalError

public void fatalError(SAXParseException e)
                throws SAXException
Description copied from class: HandlerBase
Report a fatal XML parsing error.

The default implementation throws a SAXParseException. Application writers may override this method in a subclass if they need to take specific actions for each fatal error (such as collecting all of the errors into a single report): in any case, the application must stop all regular processing when this method is invoked, since the document is no longer reliable, and the parser may no longer report parsing events.

Specified by:
fatalError in interface ErrorHandler
Overrides:
fatalError in class HandlerBase
Parameters:
e -
Throws:
SAXException
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException), SAXParseException


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