org.apache.xmlrpc

Class XmlRpcServer

public class XmlRpcServer extends 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

Field Summary
DefaultHandlerMappinghandlerMapping
We want the $default handler to always be available.
intmaxThreads
The maximum number of threads which can be used concurrently, by defaut use the one defined in XmlRpc
intnbrWorkers
Stackpool
Constructor Summary
XmlRpcServer()
Construct a new XML-RPC server.
Method Summary
voidaddHandler(String handlerName, Object handler)
protected XmlRpcWorkercreateWorker()
byte[]execute(InputStream is)
Parse the request and execute the handler method, if one is found.
byte[]execute(InputStream is, String user, String password)
Parse the request and execute the handler method, if one is found.
byte[]execute(InputStream is, XmlRpcContext context)
Parse the request and execute the handler method, if one is found.
XmlRpcHandlerMappinggetHandlerMapping()
Return the current XmlRpcHandlerMapping.
intgetMaxThreads()
Get the MaxThreads for this Server
protected XmlRpcWorkergetWorker()
Hands out pooled workers.
voidremoveHandler(String handlerName)
voidsetMaxThreads(int maxThreads)
Set the MaxThreads for this Client

Field Detail

handlerMapping

private DefaultHandlerMapping handlerMapping
We want the $default handler to always be available.

maxThreads

private int maxThreads
The maximum number of threads which can be used concurrently, by defaut use the one defined in XmlRpc

nbrWorkers

private int nbrWorkers

pool

private Stack pool

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(String handlerName, Object handler)

See Also: DefaultHandlerMapping

createWorker

protected XmlRpcWorker createWorker()

execute

public byte[] execute(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(InputStream is, String user, 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(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.

getHandlerMapping

public XmlRpcHandlerMapping getHandlerMapping()
Return the current XmlRpcHandlerMapping.

getMaxThreads

public int getMaxThreads()
Get the MaxThreads for this Server

getWorker

protected XmlRpcWorker getWorker()
Hands out pooled workers.

Returns: A worker (never null).

Throws: RuntimeException If the server exceeds its maximum number of allowed requests.

removeHandler

public void removeHandler(String handlerName)

See Also: removeHandler

setMaxThreads

public void setMaxThreads(int maxThreads)
Set the MaxThreads for this Client
Copyright B) 1999-2002 Apache Software Foundation. All Rights Reserved.