org.apache.xmlrpc
Class XmlRpcServer

java.lang.Object
  |
  +--org.apache.xmlrpc.XmlRpcServer

public class XmlRpcServer
extends java.lang.Object

A multithreaded, reusable XML-RPC server object. The name may be misleading because this does not open any server sockets. Instead it is fed by passing an XML-RPC input stream to the execute method. If you want to open a HTTP listener, use the WebServer class instead.

Author:
Hannes Wallnoefer, Daniel Rall

Inner Class Summary
(package private)  class XmlRpcServer.Worker
          Performs streaming, parsing, and handler execution.
 
Field Summary
private static byte[] EMPTY_BYTE_ARRAY
           
private  java.util.Hashtable handlers
           
private  java.util.Stack pool
           
private  int workers
           
 
Constructor Summary
XmlRpcServer()
          Construct a new XML-RPC server.
 
Method Summary
 void addHandler(java.lang.String handlername, java.lang.Object handler)
          Register a handler object with this name.
 byte[] execute(java.io.InputStream is)
          Parse the request and execute the handler method, if one is found.
 byte[] execute(java.io.InputStream is, java.lang.String user, java.lang.String password)
          Parse the request and execute the handler method, if one is found.
private  XmlRpcServer.Worker getWorker()
           
 void removeHandler(java.lang.String handlername)
          Remove a handler object that was previously registered with this server.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

EMPTY_BYTE_ARRAY

private static final byte[] EMPTY_BYTE_ARRAY

handlers

private java.util.Hashtable handlers

pool

private java.util.Stack pool

workers

private int workers
Constructor Detail

XmlRpcServer

public XmlRpcServer()
Construct a new XML-RPC server. You have to register handlers to make it do something useful.
Method Detail

addHandler

public void addHandler(java.lang.String handlername,
                       java.lang.Object handler)
Register a handler object with this name. Methods of this objects will be callable over XML-RPC as "handlername.methodname". For more information about XML-RPC handlers see the main documentation page.
Parameters:
handlername - The name to identify the handler by.
handler - The handler itself.

removeHandler

public void removeHandler(java.lang.String handlername)
Remove a handler object that was previously registered with this server.
Parameters:
handlername - The name identifying the handler to remove.

execute

public byte[] execute(java.io.InputStream is)
Parse the request and execute the handler method, if one is found. Returns the result as XML. The calling Java code doesn't need to know whether the call was successful or not since this is all packed into the response.

execute

public byte[] execute(java.io.InputStream is,
                      java.lang.String user,
                      java.lang.String password)
Parse the request and execute the handler method, if one is found. If the invoked handler is AuthenticatedXmlRpcHandler, use the credentials to authenticate the user.

getWorker

private final XmlRpcServer.Worker getWorker()


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