org.apache.xmlrpc
Class XmlRpcServer

java.lang.Object
  extended by 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 L. Rall, Andrew Evers

Constructor Summary
XmlRpcServer()
          Construct a new XML-RPC server.
 
Method Summary
 void addHandler(java.lang.String handlerName, java.lang.Object handler)
           
protected  XmlRpcWorker createWorker()
           
 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.
 byte[] execute(java.io.InputStream is, XmlRpcContext context)
          Parse the request and execute the handler method, if one is found.
 XmlRpcHandlerMapping getHandlerMapping()
          Return the current XmlRpcHandlerMapping.
 int getMaxThreads()
          Get the MaxThreads for this Server
protected  XmlRpcWorker getWorker()
          Hands out pooled workers.
 void removeHandler(java.lang.String handlerName)
           
 void setMaxThreads(int maxThreads)
          Set the MaxThreads for this Client
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
See Also:
DefaultHandlerMapping.addHandler(String, Object)

removeHandler

public void removeHandler(java.lang.String handlerName)
See Also:
DefaultHandlerMapping.removeHandler(String)

getHandlerMapping

public XmlRpcHandlerMapping getHandlerMapping()
Return the current XmlRpcHandlerMapping.


setMaxThreads

public void setMaxThreads(int maxThreads)
Set the MaxThreads for this Client


getMaxThreads

public int getMaxThreads()
Get the MaxThreads for this Server


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. No context information is passed.


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. No context information is passed.


execute

public byte[] execute(java.io.InputStream is,
                      XmlRpcContext context)
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. Context information is passed to the worker, and may be passed to the request handler.


getWorker

protected XmlRpcWorker getWorker()
Hands out pooled workers.

Returns:
A worker (never null).
Throws:
java.lang.RuntimeException - If the server exceeds its maximum number of allowed requests.

createWorker

protected XmlRpcWorker createWorker()


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