org.apache.xmlrpc
Class XmlRpc

java.lang.Object
  |
  +--org.xml.sax.HandlerBase
        |
        +--org.apache.xmlrpc.XmlRpc
All Implemented Interfaces:
org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
Direct Known Subclasses:
XmlRpcClient.Worker, XmlRpcServer.Worker

public abstract class XmlRpc
extends org.xml.sax.HandlerBase

This abstract base class provides basic capabilities for XML-RPC, like parsing of parameters or encoding Java objects into XML-RPC format. Any XML parser with a SAX interface can be used.

XmlRpcServer and XmlRpcClient are the classes that actually implement an XML-RCP server and client.

Author:
Hannes Wallnoefer
See Also:
XmlRpcServer, XmlRpcClient

Inner Class Summary
(package private)  class XmlRpc.Value
          This represents an XML-RPC Value while the request is being parsed.
(package private)  class XmlRpc.XmlWriter
           
 
Field Summary
(package private) static int ARRAY
           
(package private) static int BASE64
           
(package private) static int BOOLEAN
           
(package private)  java.lang.StringBuffer cdata
           
(package private)  XmlRpc.Value currentValue
           
(package private) static int DATE
           
(package private) static Formatter dateformat
           
static boolean debug
           
(package private) static int DOUBLE
           
(package private) static java.lang.String encoding
           
(package private) static java.util.Properties encodings
           
(package private)  int errorLevel
           
(package private)  java.lang.String errorMsg
           
(package private) static int FATAL
           
(package private) static int INTEGER
           
(package private) static boolean keepalive
           
(package private)  java.lang.String methodName
           
(package private) static int NONE
           
private static java.lang.Class parserClass
           
(package private)  boolean readCdata
           
(package private) static int RECOVERABLE
           
private static java.util.Hashtable saxDrivers
           
(package private) static int STRING
           
(package private) static int STRUCT
           
(package private) static java.lang.String[] types
           
(package private)  java.util.Stack values
           
static java.lang.String version
           
 
Constructor Summary
XmlRpc()
           
 
Method Summary
(package private) static void ()
           
(package private) static void ()
           
 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(org.xml.sax.SAXParseException e)
          Receive notification of a recoverable parser error.
 void fatalError(org.xml.sax.SAXParseException e)
          Report a fatal XML parsing error.
 java.lang.String getEncoding()
          Return the encoding, transforming to the canonical name if possible.
static boolean getKeepAlive()
          get current HTTP keepalive mode.
(package private) abstract  void objectParsed(java.lang.Object what)
          This method is called when a root level object 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.
static void setDriver(java.lang.Class driver)
          Set the SAX Parser to be used by directly passing the Class object.
static void setDriver(java.lang.String driver)
          Set the SAX Parser to be used.
static void setEncoding(java.lang.String enc)
          Set the encoding of the XML.
static void setKeepAlive(boolean val)
          Switch HTTP keepalive on/off.
 void startElement(java.lang.String name, org.xml.sax.AttributeList atts)
          Method called by SAX driver.
(package private)  void writeObject(java.lang.Object what, XmlRpc.XmlWriter writer)
          Writes the XML representation of a supported Java object to the XML writer.
 
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, registerNatives, toString, wait, wait, wait
 

Field Detail

version

public static final java.lang.String version

methodName

java.lang.String methodName

parserClass

private static java.lang.Class parserClass

saxDrivers

private static java.util.Hashtable saxDrivers

values

java.util.Stack values

currentValue

XmlRpc.Value currentValue

dateformat

static Formatter dateformat

cdata

java.lang.StringBuffer cdata

readCdata

boolean readCdata

STRING

static final int STRING

INTEGER

static final int INTEGER

BOOLEAN

static final int BOOLEAN

DOUBLE

static final int DOUBLE

DATE

static final int DATE

BASE64

static final int BASE64

STRUCT

static final int STRUCT

ARRAY

static final int ARRAY

errorLevel

int errorLevel

errorMsg

java.lang.String errorMsg

NONE

static final int NONE

RECOVERABLE

static final int RECOVERABLE

FATAL

static final int FATAL

keepalive

static boolean keepalive

debug

public static boolean debug

types

static final java.lang.String[] types

encoding

static java.lang.String encoding

encodings

static java.util.Properties encodings
Constructor Detail

XmlRpc

public XmlRpc()
Method Detail

static void ()

static void ()

setDriver

public static void setDriver(java.lang.String driver)
                      throws java.lang.ClassNotFoundException
Set the SAX Parser to be used. The argument can either be the full class name or a user friendly shortcut if the parser is known to this class. The parsers that can currently be set by shortcut are listed in the main documentation page. If you are using another parser please send me the name of the SAX driver and I'll include it in a future release. If setDriver() is never called then the System property "sax.driver" is consulted. If that is not defined the driver defaults to OpenXML.

setDriver

public static void setDriver(java.lang.Class driver)
Set the SAX Parser to be used by directly passing the Class object.

setEncoding

public static void setEncoding(java.lang.String enc)
Set the encoding of the XML. This should be the name of a Java encoding contained in the encodings Hashtable.

getEncoding

public java.lang.String getEncoding()
Return the encoding, transforming to the canonical name if possible.

setDebug

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

setKeepAlive

public static void setKeepAlive(boolean val)
Switch HTTP keepalive on/off.

getKeepAlive

public static boolean getKeepAlive()
get current HTTP keepalive mode.

parse

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

writeObject

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

objectParsed

abstract void objectParsed(java.lang.Object what)
This method is called when a root level object has been parsed.

characters

public void characters(char[] ch,
                       int start,
                       int length)
                throws org.xml.sax.SAXException
Method called by SAX driver.
Overrides:
characters in class org.xml.sax.HandlerBase
Following copied from class: org.xml.sax.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:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.characters(char[], int, int)

endElement

public void endElement(java.lang.String name)
                throws org.xml.sax.SAXException
Method called by SAX driver.
Overrides:
endElement in class org.xml.sax.HandlerBase
Following copied from class: org.xml.sax.HandlerBase
Parameters:
name - The element type name.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.endElement(java.lang.String)

startElement

public void startElement(java.lang.String name,
                         org.xml.sax.AttributeList atts)
                  throws org.xml.sax.SAXException
Method called by SAX driver.
Overrides:
startElement in class org.xml.sax.HandlerBase
Following copied from class: org.xml.sax.HandlerBase
Parameters:
name - The element type name.
attributes - The specified or defaulted attributes.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
DocumentHandler.startElement(java.lang.String, org.xml.sax.AttributeList)

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.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.

Overrides:
error in class org.xml.sax.HandlerBase
Following copied from class: org.xml.sax.HandlerBase
Parameters:
e - The warning information encoded as an exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.warning(org.xml.sax.SAXParseException), SAXParseException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Description copied from class: org.xml.sax.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.

Overrides:
fatalError in class org.xml.sax.HandlerBase
Following copied from class: org.xml.sax.HandlerBase
Parameters:
e - The error information encoded as an exception.
Throws:
org.xml.sax.SAXException - Any SAX exception, possibly wrapping another exception.
See Also:
ErrorHandler.fatalError(org.xml.sax.SAXParseException), SAXParseException


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.