aevers      2002/12/05 00:49:25

  Modified:    src/java/org/apache/xmlrpc MultiCall.java XmlRpcClient.java
                        XmlRpcClientLite.java XmlRpcRequest.java
                        XmlRpcRequestProcessor.java
                        XmlRpcResponseProcessor.java XmlRpcWorker.java
                        XmlWriter.java
  Added:       src/java/org/apache/xmlrpc DefaultXmlRpcTransport.java
                        LiteXmlRpcTransport.java XmlRpcClientException.java
                        XmlRpcClientRequest.java
                        XmlRpcClientRequestProcessor.java
                        XmlRpcClientResponseProcessor.java
                        XmlRpcClientWorker.java XmlRpcServerRequest.java
                        XmlRpcTransport.java XmlRpcTransportFactory.java
  Log:
  Major refactoring of client code to separate XML-RPC and HTTP layers. It is
  now possible to implement XML-RPC over an arbitrary (but HTTP-like) transport
  by implementing XmlRpcTransport.
  
  Refactor XmlRpcRequest to implement XmlRpcServerRequest and XmlRpcClientRequest
  interfaces. This allows custom implementations of these interfaces that
  provide more efficient storage, particularly on the client side.
  
  Refactor client threading and worker code along the lines of the work done
  on the server code.
  
  Revision  Changes    Path
  1.2       +2 -2      xml-rpc/src/java/org/apache/xmlrpc/MultiCall.java
  
  Index: MultiCall.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/MultiCall.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MultiCall.java    21 Oct 2002 13:08:50 -0000      1.1
  +++ MultiCall.java    5 Dec 2002 08:49:24 -0000       1.2
  @@ -85,7 +85,7 @@
       public Vector multicall(Vector requests, XmlRpcContext context)
       {
           Vector response = new Vector();
  -        XmlRpcRequest request;
  +        XmlRpcServerRequest request;
           for (int i = 0; i < requests.size(); i++)
           {
               try
  
  
  
  1.15      +127 -241  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClient.java
  
  Index: XmlRpcClient.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClient.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XmlRpcClient.java 21 Nov 2002 01:28:16 -0000      1.14
  +++ XmlRpcClient.java 5 Dec 2002 08:49:24 -0000       1.15
  @@ -76,6 +76,7 @@
    * work better for you.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
    * @version $Id$
    */
   public class XmlRpcClient implements XmlRpcHandler
  @@ -87,11 +88,22 @@
       protected Stack pool = new Stack();
       protected int workers = 0;
       protected int asyncWorkers = 0;
  +    protected XmlRpcTransportFactory transportFactory;
   
       // a queue of calls to be handled asynchronously
       private CallData first, last;
   
       /**
  +     * Construct a XML-RPC client with this URL and a specified transport
  +     * factory.
  +     */
  +    public XmlRpcClient(URL url, XmlRpcTransportFactory transportFactory)
  +    {
  +       this.url = url;
  +       this.transportFactory = transportFactory;
  +    }
  +
  +    /**
        * Construct a XML-RPC client with this URL.
        */
       public XmlRpcClient(URL url)
  @@ -157,10 +169,22 @@
       public Object execute(String method, Vector params)
               throws XmlRpcException, IOException
       {
  -        Worker worker = getWorker(false);
  +        return execute(new XmlRpcRequest(method, params));
  +    }
  +
  +    public Object execute(XmlRpcClientRequest request)
  +            throws XmlRpcException, IOException
  +    {
  +        return execute(request, createTransport());
  +    }
  +
  +    public Object execute(XmlRpcClientRequest request, XmlRpcTransport transport)
  +            throws XmlRpcException, IOException
  +    {
  +        XmlRpcClientWorker worker = getWorker(false);
           try
           {
  -            Object retval = worker.execute(method, params);
  +            Object retval = worker.execute(request, transport);
               return retval;
           }
           finally
  @@ -168,7 +192,6 @@
               releaseWorker(worker, false);
           }
       }
  -
       /**
        * Generate an XML-RPC request and send it to the server in a new thread.
        * This method returns immediately.
  @@ -178,37 +201,111 @@
       public void executeAsync(String method, Vector params,
               AsyncCallback callback)
       {
  +        executeAsync(new XmlRpcRequest(method, params), callback);
  +    }
  +
  +    public void executeAsync(XmlRpcClientRequest request,
  +            AsyncCallback callback)
  +    {
  +        executeAsync(request, callback, null);
  +    }
  +
  +    public void executeAsync(XmlRpcClientRequest request,
  +            AsyncCallback callback, XmlRpcTransport transport)
  +    {
  +        CallData call = new CallData(request, callback, transport);
  +
           // if at least 4 threads are running, don't create any new ones,
           // just enqueue the request.
           if (asyncWorkers >= 4)
           {
  -            enqueue(method, params, callback);
  +            enqueue(call);
               return;
           }
  -        Worker worker = null;
  +        XmlRpcClientWorker worker = null;
           try
           {
  -            worker = getWorker(true);
  -            worker.start(method, params, callback);
  +            new XmlRpcClientAsyncThread(getWorker(true), call).start();
           }
           catch(IOException iox)
           {
               // make a queued worker that doesn't run immediately
  -            enqueue(method, params, callback);
  +            enqueue(call);
           }
       }
   
  +    class XmlRpcClientAsyncThread extends Thread
  +    {
  +        protected XmlRpcClientWorker worker;
  +        protected CallData call;
  +
  +        protected XmlRpcClientAsyncThread(XmlRpcClientWorker worker, CallData 
initialCall)
  +        {
  +           this.worker = worker;
  +           this.call = initialCall;
  +        }
  +
  +        public void run()
  +        {
  +            try
  +            {
  +                while (call != null)
  +                {
  +                    call = dequeue();
  +                    executeAsync(call.request, call.callback, call.transport);
  +                }
  +            }
  +            finally
  +            {
  +                releaseWorker(worker, true);
  +            }
  +        }
  +
  +        /**
  +         * Execute an XML-RPC call and handle asyncronous callback.
  +         */
  +        void executeAsync(XmlRpcClientRequest request, AsyncCallback callback, 
XmlRpcTransport transport)
  +        {
  +            Object res = null;
  +            try
  +            {
  +                if (transport == null)
  +                {
  +                    transport = createTransport();
  +                }
  +                res = worker.execute(request, transport);
  +                // notify callback object
  +                if (callback != null)
  +                {
  +                    callback.handleResult(res, url, request.getMethodName());
  +                }
  +            }
  +            catch(Exception x)
  +            {
  +                if (callback != null)
  +                {
  +                    try
  +                    {
  +                        callback.handleError(x, url, request.getMethodName());
  +                    }
  +                    catch(Exception ignore)
  +                    {
  +                    }
  +                }
  +            }
  +        }
  +    }
       /**
        *
        * @param async
        * @return
        * @throws IOException
        */
  -    synchronized Worker getWorker(boolean async) throws IOException
  +    synchronized XmlRpcClientWorker getWorker(boolean async) throws IOException
       {
           try
           {
  -            Worker w = (Worker) pool.pop();
  +            XmlRpcClientWorker w = (XmlRpcClientWorker) pool.pop();
               if (async)
               {
                   asyncWorkers += 1;
  @@ -231,7 +328,7 @@
                   {
                       workers += 1;
                   }
  -                return new Worker();
  +                return new XmlRpcClientWorker();
               }
               throw new IOException("XML-RPC System overload");
           }
  @@ -241,11 +338,9 @@
        * Release possibly big per-call object references to allow them to be
        * garbage collected
        */
  -    synchronized void releaseWorker(Worker w, boolean async)
  +    synchronized void releaseWorker(XmlRpcClientWorker w, boolean async)
       {
  -        w.result = null;
  -        w.call = null;
  -        if (pool.size() < 20 && !w.fault)
  +        if (pool.size() < 20)
           {
               pool.push(w);
           }
  @@ -265,10 +360,8 @@
        * @param params
        * @param callback
        */
  -    synchronized void enqueue(String method, Vector params,
  -            AsyncCallback callback)
  +    synchronized void enqueue(CallData call)
       {
  -        CallData call = new CallData(method, params, callback);
           if (last == null)
           {
               first = last = call;
  @@ -302,226 +395,10 @@
           return call;
       }
   
  -    /**
  -     *
  -     */
  -    class Worker extends XmlRpc implements Runnable
  -    {
  -        boolean fault;
  -        Object result = null;
  -
  -        /**
  -         * The output buffer used in creating a request.
  -         */
  -        ByteArrayOutputStream buffer;
  -
  -        CallData call;
  -
  -        /**
  -         *
  -         */
  -        public Worker()
  -        {
  -            super();
  -        }
  -
  -        /**
  -         *
  -         * @param method
  -         * @param params
  -         * @param callback
  -         */
  -        public void start(String method, Vector params,
  -                AsyncCallback callback)
  -        {
  -            this.call = new CallData(method, params, callback);
  -            Thread t = new Thread(this);
  -            t.start();
  -        }
  -
  -        /**
  -         *
  -         */
  -        public void run()
  -        {
  -            while (call != null)
  -            {
  -                executeAsync(call.method, call.params, call.callback);
  -                call = dequeue();
  -            }
  -            releaseWorker(this, true);
  -        }
  -
  -        /**
  -         * Execute an XML-RPC call and handle asyncronous callback.
  -         */
  -        void executeAsync(String method, Vector params, AsyncCallback callback)
  -        {
  -            Object res = null;
  -            try
  -            {
  -                res = execute(method, params);
  -                // notify callback object
  -                if (callback != null)
  -                {
  -                    callback.handleResult(res, url, method);
  -                }
  -            }
  -            catch(Exception x)
  -            {
  -                if (callback != null)
  -                {
  -                    try
  -                    {
  -                        callback.handleError(x, url, method);
  -                    }
  -                    catch(Exception ignore)
  -                    {
  -                    }
  -                }
  -            }
  -        }
  -
  -        /**
  -         * Execute an XML-RPC call.
  -         */
  -        Object execute(String method, Vector params)
  -                throws XmlRpcException, IOException
  -        {
  -            fault = false;
  -            long now = 0;
  -
  -            if (XmlRpc.debug)
  -            {
  -                System.out.println("Client calling procedure '" + method
  -                        + "' with parameters " + params);
  -                now = System.currentTimeMillis();
  -            }
  -
  -            try
  -            {
  -                ByteArrayOutputStream bout = new ByteArrayOutputStream();
  -
  -                if (buffer == null)
  -                {
  -                    buffer = new ByteArrayOutputStream();
  -                }
  -                else
  -                {
  -                    buffer.reset();
  -                }
  -
  -                XmlWriter writer = new XmlWriter(buffer, encoding);
  -                writeRequest(writer, method, params);
  -                writer.flush();
  -                byte[] request = buffer.toByteArray();
  -
  -                URLConnection con = url.openConnection();
  -                con.setDoInput(true);
  -                con.setDoOutput(true);
  -                con.setUseCaches(false);
  -                con.setAllowUserInteraction(false);
  -                con.setRequestProperty("Content-Length",
  -                        Integer.toString(request.length));
  -                con.setRequestProperty("Content-Type", "text/xml");
  -                if (auth != null)
  -                {
  -                    con.setRequestProperty("Authorization", "Basic " + auth);
  -                }
  -                OutputStream out = con.getOutputStream();
  -                out.write(request);
  -                out.flush();
  -                out.close();
  -                InputStream in = con.getInputStream();
  -                parse(in);
  -            }
  -            catch(Exception x)
  -            {
  -                if (XmlRpc.debug)
  -                {
  -                    x.printStackTrace();
  -                }
  -                throw new IOException(x.getMessage());
  -            }
  -
  -            if (fault)
  -            {
  -                // generate an XmlRpcException
  -                XmlRpcException exception = null;
  -                try
  -                {
  -                    Hashtable f =(Hashtable) result;
  -                    String faultString =(String) f.get("faultString");
  -                    int faultCode = Integer.parseInt(
  -                            f.get("faultCode").toString());
  -                    exception = new XmlRpcException(faultCode,
  -                            faultString.trim());
  -                }
  -                catch(Exception x)
  -                {
  -                    throw new XmlRpcException(0, "Invalid fault response");
  -                }
  -                throw exception;
  -            }
  -            if (XmlRpc.debug)
  -            {
  -                System.out.println("Spent " + (System.currentTimeMillis() - now)
  -                        + " in request");
  -            }
  -            return result;
  -        }
  -
  -        /**
  -         * Called when the return value has been parsed.
  -         */
  -        protected void objectParsed(Object what)
  -        {
  -            result = what;
  -        }
  -
  -        /**
  -         * Generate an XML-RPC request from a method name and a parameter vector.
  -         */
  -        void writeRequest(XmlWriter writer, String method, Vector params)
  -                throws IOException, XmlRpcException
  -        {
  -            writer.startElement("methodCall");
  -            writer.startElement("methodName");
  -            writer.write(method);
  -            writer.endElement("methodName");
  -            writer.startElement("params");
  -            int l = params.size();
  -            for (int i = 0; i < l; i++)
  -            {
  -                writer.startElement("param");
  -                writer.writeObject(params.elementAt(i));
  -                writer.endElement("param");
  -            }
  -            writer.endElement("params");
  -            writer.endElement("methodCall");
  -        }
  -
  -        /**
  -         * Overrides method in XmlRpc to handle fault repsonses.
  -         */
  -        public void startElement(String name, AttributeList atts)
  -                throws SAXException
  -        {
  -            if ("fault".equals(name))
  -            {
  -                fault = true;
  -            }
  -            else
  -            {
  -                super.startElement(name, atts);
  -            }
  -        }
  -    } // end of inner class Worker
  -
       class CallData
       {
  -        String method;
  -        Vector params;
  +        XmlRpcClientRequest request;
  +        XmlRpcTransport transport;
           AsyncCallback callback;
           CallData next;
   
  @@ -529,15 +406,24 @@
            * Make a call to be queued and then executed by the next free async
            * thread
            */
  -        public CallData(String method, Vector params, AsyncCallback callback)
  +        public CallData(XmlRpcClientRequest request, AsyncCallback callback, 
XmlRpcTransport transport)
           {
  -            this.method = method;
  -            this.params = params;
  +            this.request = request;
               this.callback = callback;
  +            this.transport = transport;
               this.next = null;
           }
       }
   
  +    protected XmlRpcTransport createTransport()
  +    {
  +        if (transportFactory == null)
  +        {
  +          return new DefaultXmlRpcTransport(url, auth);
  +        }
  +        return transportFactory.createTransport();
  +    }
  +
       /**
        * Just for testing.
        */
  @@ -561,7 +447,7 @@
                       v.addElement(args[i]);
                   }
               }
  -            XmlRpcClient client = new XmlRpcClientLite(url);
  +            XmlRpcClient client = new XmlRpcClient(url);
               try
               {
                   System.out.println(client.execute(method, v));
  
  
  
  1.10      +5 -383    xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientLite.java
  
  Index: XmlRpcClientLite.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientLite.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XmlRpcClientLite.java     9 Aug 2002 09:16:27 -0000       1.9
  +++ XmlRpcClientLite.java     5 Dec 2002 08:49:24 -0000       1.10
  @@ -55,17 +55,9 @@
    * <http://www.apache.org/>.
    */
   
  -import java.io.BufferedInputStream;
  -import java.io.BufferedOutputStream;
  -import java.io.ByteArrayOutputStream;
   import java.io.IOException;
  -import java.io.InputStream;
  -import java.net.MalformedURLException;
  -import java.net.Socket;
   import java.net.URL;
  -import java.util.EmptyStackException;
  -import java.util.Hashtable;
  -import java.util.StringTokenizer;
  +import java.net.MalformedURLException;
   import java.util.Vector;
   
   /**
  @@ -74,6 +66,7 @@
    * when used with XmlRpc.setKeepAlive(true).
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
  + * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
    * @version $Id$
    */
   public class XmlRpcClientLite extends XmlRpcClient
  @@ -105,380 +98,9 @@
           super (hostname, port);
       }
   
  -    /**
  -     *
  -     * @param async
  -     * @return
  -     * @throws IOException
  -     */
  -    synchronized Worker getWorker(boolean async) throws IOException
  -    {
  -        try
  -        {
  -            Worker w = (Worker) pool.pop();
  -            if (async)
  -            {
  -                asyncWorkers += 1;
  -            }
  -            else
  -            {
  -                workers += 1;
  -            }
  -            return w;
  -        }
  -        catch (EmptyStackException x)
  -        {
  -            if (workers < XmlRpc.getMaxThreads())
  -            {
  -                if (async)
  -                {
  -                    asyncWorkers += 1;
  -                }
  -                else
  -                {
  -                    workers += 1;
  -                }
  -                return new LiteWorker();
  -            }
  -            throw new IOException("XML-RPC System overload");
  -        }
  -    }
  -
  -    /**
  -     *
  -     */
  -    class LiteWorker extends Worker implements Runnable
  +    protected XmlRpcTransport createTransport()
       {
  -        HttpClient client = null;
  -
  -        /**
  -         *
  -         */
  -        public LiteWorker()
  -        {
  -            super();
  -        }
  -
  -        /**
  -         *
  -         * @param method
  -         * @param params
  -         * @return
  -         * @throws XmlRpcException
  -         * @throws IOException
  -         */
  -        Object execute(String method, Vector params)
  -                throws XmlRpcException, IOException
  -        {
  -            long now = System.currentTimeMillis();
  -            fault = false;
  -            try
  -            {
  -                if (buffer == null)
  -                {
  -                    buffer = new ByteArrayOutputStream();
  -                }
  -                else
  -                {
  -                    buffer.reset();
  -                }
  -                XmlWriter writer = new XmlWriter(buffer, encoding);
  -                writeRequest(writer, method, params);
  -                writer.flush();
  -                byte[] request = buffer.toByteArray();
  -
  -                // and send it to the server
  -                if (client == null)
  -                {
  -                    client = new HttpClient(url);
  -                }
  -
  -                InputStream in = null;
  -
  -               // send request to the server and get an input stream
  -               // from which to read the response
  -                try
  -                {
  -                    in = client.sendRequest(request);
  -                }
  -                catch (IOException iox)
  -                {
  -                    // if we get an exception while sending the request,
  -                    // and the connection is a keepalive connection, it may
  -                    // have been timed out by the server. Try again.
  -                    if (client.keepalive)
  -                    {
  -                        client.closeConnection();
  -                        client.initConnection();
  -                        in = client.sendRequest(request);
  -                    }
  -                    else
  -                    {
  -                        throw iox;
  -                    }
  -                }
  -
  -                // parse the response
  -                parse(in);
  -
  -                // client keepalive is always false if XmlRpc.keepalive is false
  -                if (!client.keepalive)
  -                {
  -                    client.closeConnection ();
  -                    client = null;
  -                }
  -
  -                if (debug)
  -                {
  -                    System.out.println ("result = " + result);
  -                }
  -
  -                // check for errors from the XML parser
  -                if (errorLevel == FATAL)
  -                {
  -                    throw new Exception (errorMsg);
  -                }
  -            }
  -            catch (IOException iox)
  -            {
  -                // this is a lower level problem,  client could not talk to
  -                // server for some reason.
  -                throw iox;
  -            }
  -            catch (Exception x)
  -            {
  -                // same as above, but exception has to be converted to
  -                // IOException.
  -                if (XmlRpc.debug)
  -                {
  -                    x.printStackTrace ();
  -                }
  -
  -                String msg = x.getMessage ();
  -                if (msg == null || msg.length () == 0)
  -                {
  -                    msg = x.toString ();
  -                }
  -                throw new IOException (msg);
  -            }
  -
  -            if (fault)
  -            {
  -                // this is an XML-RPC-level problem, i.e. the server reported an 
error.
  -                // throw an XmlRpcException.
  -                XmlRpcException exception = null;
  -                try
  -                {
  -                    Hashtable f = (Hashtable) result;
  -                    String faultString = (String) f.get("faultString");
  -                    int faultCode = Integer.parseInt(
  -                            f.get("faultCode").toString());
  -                    exception = new XmlRpcException(faultCode,
  -                            faultString.trim());
  -                }
  -                catch (Exception x)
  -                {
  -                    throw new XmlRpcException(0,
  -                            "Server returned an invalid fault response.");
  -                }
  -                throw exception;
  -            }
  -            if (debug)
  -            {
  -                System.out.println ("Spent " + (System.currentTimeMillis()
  -                        - now) + " millis in request");
  -            }
  -            return result;
  -        }
  -    } // end of class Worker
  -
  -    /**
  -     * A replacement for java.net.URLConnection, which seems very slow on
  -     * MS Java.
  -     */
  -    class HttpClient
  -    {
  -        String hostname;
  -        String host;
  -        int port;
  -        String uri;
  -        Socket socket = null;
  -        BufferedOutputStream output;
  -        BufferedInputStream input;
  -        boolean keepalive;
  -        byte[] buffer;
  -
  -        /**
  -         *
  -         * @param url
  -         * @throws IOException
  -         */
  -        public HttpClient(URL url) throws IOException
  -        {
  -            hostname = url.getHost();
  -            port = url.getPort();
  -            if (port < 1)
  -            {
  -                port = 80;
  -            }
  -            uri = url.getFile();
  -            if (uri == null || "".equals(uri))
  -            {
  -                uri = "/";
  -            }
  -            host = port == 80 ? hostname : hostname + ":" + port;
  -            initConnection();
  -        }
  -
  -        /**
  -         *
  -         * @throws IOException
  -         */
  -        protected void initConnection() throws IOException
  -        {
  -            socket = new Socket(hostname, port);
  -            output = new BufferedOutputStream(socket.getOutputStream());
  -            input = new BufferedInputStream(socket.getInputStream());
  -        }
  -
  -        /**
  -         *
  -         */
  -        protected void closeConnection ()
  -        {
  -            try
  -            {
  -                socket.close();
  -            }
  -            catch (Exception ignore)
  -            {
  -            }
  -        }
  -
  -        /**
  -         *
  -         * @param request
  -         * @return
  -         * @throws IOException
  -         */
  -        public InputStream sendRequest(byte[] request) throws IOException
  -        {
  -            output.write(("POST " + uri + " HTTP/1.0\r\n").getBytes());
  -            output.write(("User-Agent: " + XmlRpc.version + "\r\n").getBytes());
  -            output.write(("Host: " + host + "\r\n").getBytes());
  -            if (XmlRpc.getKeepAlive())
  -            {
  -                output.write("Connection: Keep-Alive\r\n".getBytes());
  -            }
  -            output.write("Content-Type: text/xml\r\n".getBytes());
  -            if (auth != null)
  -            {
  -                output.write(("Authorization: Basic " + auth + "\r\n")
  -                        .getBytes());
  -            }
  -            output.write(("Content-Length: " + request.length)
  -                    .getBytes());
  -            output.write("\r\n\r\n".getBytes());
  -            output.write(request);
  -            output.flush();
  -
  -            // start reading  server response headers
  -            String line = readLine();
  -            if (XmlRpc.debug)
  -            {
  -                System.out.println(line);
  -            }
  -            int contentLength = -1;
  -            try
  -            {
  -                StringTokenizer tokens = new StringTokenizer(line);
  -                String httpversion = tokens.nextToken();
  -                String statusCode = tokens.nextToken();
  -                String statusMsg = tokens.nextToken("\n\r");
  -                keepalive = XmlRpc.getKeepAlive()
  -                        && "HTTP/1.1".equals(httpversion);
  -                if (! "200".equals(statusCode))
  -                {
  -                    throw new IOException("Unexpected Response from Server: "
  -                            + statusMsg);
  -                }
  -            }
  -            catch (IOException iox)
  -            {
  -                throw iox;
  -            }
  -            catch (Exception x)
  -            {
  -                // x.printStackTrace ();
  -                throw new IOException("Server returned invalid Response.");
  -            }
  -            do
  -            {
  -                line = readLine ();
  -                if (line != null)
  -                {
  -                    if (XmlRpc.debug)
  -                    {
  -                        System.out.println(line);
  -                    }
  -                    line = line.toLowerCase();
  -                    if (line.startsWith("content-length:"))
  -                    {
  -                        contentLength = Integer.parseInt(
  -                                line.substring(15).trim());
  -                    }
  -                    if (line.startsWith("connection:"))
  -                    {
  -                        keepalive = XmlRpc.getKeepAlive()
  -                                && line.indexOf("keep-alive") > -1;
  -                    }
  -                }
  -            }
  -            while (line != null && ! line.equals(""))
  -                ;
  -            return new ServerInputStream(input, contentLength);
  -        }
  -
  -        /**
  -         *
  -         * @return
  -         * @throws IOException
  -         */
  -        private String readLine() throws IOException
  -        {
  -            if (buffer == null)
  -            {
  -                buffer = new byte[2048];
  -            }
  -            int next;
  -            int count = 0;
  -            while (true)
  -            {
  -                next = input.read();
  -                if (next < 0 || next == '\n')
  -                {
  -                    break;
  -                }
  -                if (next != '\r')
  -                {
  -                    buffer[count++] = (byte) next;
  -                }
  -                if (count >= buffer.length)
  -                {
  -                    throw new IOException ("HTTP Header too long");
  -                }
  -            }
  -            return new String(buffer, 0, count);
  -        }
  -
  -        /**
  -         *
  -         * @throws Throwable
  -         */
  -        protected void finalize() throws Throwable
  -        {
  -            closeConnection ();
  -        }
  +        return new LiteXmlRpcTransport(url);
       }
   
       /**
  
  
  
  1.4       +8 -2      xml-rpc/src/java/org/apache/xmlrpc/XmlRpcRequest.java
  
  Index: XmlRpcRequest.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcRequest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XmlRpcRequest.java        21 Oct 2002 13:08:50 -0000      1.3
  +++ XmlRpcRequest.java        5 Dec 2002 08:49:24 -0000       1.4
  @@ -58,13 +58,14 @@
   import java.util.Vector;
   
   /**
  - * Encapsulates an XML-RPC request.
  + * Default implementation of an XML-RPC request for both client and server.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
    * @version $Id$
    * @since 1.2
    */
   public class XmlRpcRequest
  +implements XmlRpcServerRequest, XmlRpcClientRequest
   {
       protected final String methodName;
       protected final Vector parameters;
  @@ -75,6 +76,11 @@
           this.methodName = methodName;
       }
   
  +    public int getParameterCount()
  +    {
  +        return parameters.size();
  +    }
  +    
       public Vector getParameters()
       {
           return parameters;
  
  
  
  1.5       +5 -3      xml-rpc/src/java/org/apache/xmlrpc/XmlRpcRequestProcessor.java
  
  Index: XmlRpcRequestProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcRequestProcessor.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XmlRpcRequestProcessor.java       21 Nov 2002 01:28:16 -0000      1.4
  +++ XmlRpcRequestProcessor.java       5 Dec 2002 08:49:24 -0000       1.5
  @@ -59,7 +59,7 @@
   import java.util.Vector;
   
   /**
  - * Process an InputStream and produce and XmlRpcRequest.  This class
  + * Process an InputStream and produce an XmlRpcServerRequest.  This class
    * is NOT thread safe.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
  @@ -80,13 +80,15 @@
       }
   
       /**
  -     * Process a request.
  +     * Decode a request from an InputStream to the internal XmlRpcRequest
  +     * implementation. This method must read data from the specified stream and
  +     * return an XmlRpcRequest object, or throw an exception.
        *
        * @param is the stream to read the request from.
        * @returns XMLRpcRequest the request.
        * @throws ParseFailed if unable to parse the request.
        */
  -    public XmlRpcRequest processRequest(InputStream is)
  +    public XmlRpcServerRequest decodeRequest(InputStream is)
       {
           long now = 0;
   
  
  
  
  1.2       +2 -2      xml-rpc/src/java/org/apache/xmlrpc/XmlRpcResponseProcessor.java
  
  Index: XmlRpcResponseProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcResponseProcessor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XmlRpcResponseProcessor.java      26 Aug 2002 17:41:57 -0000      1.1
  +++ XmlRpcResponseProcessor.java      5 Dec 2002 08:49:24 -0000       1.2
  @@ -81,7 +81,7 @@
        * @param encoding The output encoding.
        * @return byte[] The XML-RPC response.
        */
  -    public byte[] processResponse(Object responseParam, String encoding)
  +    public byte[] encodeResponse(Object responseParam, String encoding)
           throws IOException, UnsupportedEncodingException, XmlRpcException
       {
           long now = 0;
  @@ -116,7 +116,7 @@
        * @param encoding The output encoding.
        * @return byte[] The XML-RPC response.
        */
  -    public byte[] processException(Exception x, String encoding)
  +    public byte[] encodeException(Exception x, String encoding)
       {
           if (XmlRpc.debug)
           {
  
  
  
  1.5       +4 -4      xml-rpc/src/java/org/apache/xmlrpc/XmlRpcWorker.java
  
  Index: XmlRpcWorker.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlRpcWorker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XmlRpcWorker.java 21 Oct 2002 13:08:50 -0000      1.4
  +++ XmlRpcWorker.java 5 Dec 2002 08:49:24 -0000       1.5
  @@ -97,7 +97,7 @@
        * @throws NullPointerException if the handler is null.
        * @throws Exception if the handler throws an exception.
        */
  -    protected static Object invokeHandler(Object handler, XmlRpcRequest request, 
XmlRpcContext context)
  +    protected static Object invokeHandler(Object handler, XmlRpcServerRequest 
request, XmlRpcContext context)
           throws Exception
       {
           long now = 0;
  @@ -179,11 +179,11 @@
   
           try
           {
  -            XmlRpcRequest request = requestProcessor.processRequest(is);
  +            XmlRpcServerRequest request = requestProcessor.decodeRequest(is);
               Object handler = handlerMapping.getHandler(request.
                                                          getMethodName());
               Object response = invokeHandler(handler, request, context);
  -            return responseProcessor.processResponse
  +            return responseProcessor.encodeResponse
                   (response, requestProcessor.getEncoding());
           }
           catch (AuthenticationFailed alertCallerAuth)
  @@ -200,7 +200,7 @@
               {
                   x.printStackTrace();
               }
  -            return responseProcessor.processException
  +            return responseProcessor.encodeException
                   (x, requestProcessor.getEncoding());
           }
           finally
  
  
  
  1.7       +9 -9      xml-rpc/src/java/org/apache/xmlrpc/XmlWriter.java
  
  Index: XmlWriter.java
  ===================================================================
  RCS file: /home/cvs/xml-rpc/src/java/org/apache/xmlrpc/XmlWriter.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XmlWriter.java    21 Nov 2002 21:57:39 -0000      1.6
  +++ XmlWriter.java    5 Dec 2002 08:49:24 -0000       1.7
  @@ -161,13 +161,13 @@
        * href="http://xml-rpc.com/spec";>XML-RPC specification</a>).
        */
       public void writeObject(Object obj)
  -        throws XmlRpcException, IOException
  +        throws XmlRpcClientException, IOException
       {
           startElement("value");
           if (obj == null)
           {
  -            throw new IllegalArgumentException
  -                ("null values not supported by XML-RPC");
  +            throw new XmlRpcClientException
  +                ("null values not supported by XML-RPC", null);
           }
           else if (obj instanceof String)
           {
  @@ -248,8 +248,8 @@
           }
           else
           {
  -            throw new RuntimeException("unsupported Java type: "
  -                                       + obj.getClass());
  +            throw new XmlRpcClientException("unsupported Java type: "
  +                                       + obj.getClass(), null);
           }
           endElement("value");
       }
  @@ -305,11 +305,11 @@
        * Writes text as <code>PCDATA</code>.
        *
        * @param text The data to write.
  -     * @exception XmlRpcException Unsupported character data found.
  +     * @exception XmlRpcClientException Unsupported character data found.
        * @exception IOException Problem writing data.
        */
       protected void chardata(String text)
  -        throws XmlRpcException, IOException
  +        throws XmlRpcClientException, IOException
       {
           int l = text.length ();
           for (int i = 0; i < l; i++)
  @@ -339,9 +339,9 @@
                       // does not allow this range of characters,
                       // resulting in a parse error from most XML
                       // parsers.
  -                    throw new XmlRpcException(0, "Invalid character data " +
  +                    throw new XmlRpcClientException("Invalid character data " +
                                                 "corresponding to XML entity &#" +
  -                                              String.valueOf((int) c) + ';');
  +                                              String.valueOf((int) c) + ';', null);
                   }
                   else
                   {
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/DefaultXmlRpcTransport.java
  
  Index: DefaultXmlRpcTransport.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.IOException;
  import java.net.URL;
  import java.net.URLConnection;
  
  /**
   * Interface from XML-RPC to the default HTTP transport based on the
   * @see java.net.URLConnection class.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: DefaultXmlRpcTransport.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public class DefaultXmlRpcTransport implements XmlRpcTransport
  {
      protected URL url;
      protected String auth;
  
      /**
       * Create a new DefaultXmlRpcTransport with the specified URL and basic
       * authorization string.
       *
       * @param url the url to POST XML-RPC requests to.
       * @param auth the Base64 encoded HTTP Basic authentication value.
       */
      public DefaultXmlRpcTransport(URL url, String auth)
      {
          this.url = url;
          this.auth = auth;
      }
  
      /**
       * Create a new DefaultXmlRpcTransport with the specified URL.
       *
       * @param url the url to POST XML-RPC requests to.
       */
      public DefaultXmlRpcTransport(URL url)
      {
          this(url, null);
      }
  
      public InputStream sendXmlRpc(byte [] request)
      throws IOException
      {
          URLConnection con = url.openConnection();
          con.setDoInput(true);
          con.setDoOutput(true);
          con.setUseCaches(false);
          con.setAllowUserInteraction(false);
          con.setRequestProperty("Content-Length",
          Integer.toString(request.length));
          con.setRequestProperty("Content-Type", "text/xml");
          if (auth != null)
          {
              con.setRequestProperty("Authorization", "Basic " + auth);
          }
          OutputStream out = con.getOutputStream();
          out.write(request);
          out.flush();
          out.close();
          return con.getInputStream();
      }
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/LiteXmlRpcTransport.java
  
  Index: LiteXmlRpcTransport.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.ByteArrayOutputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.BufferedInputStream;
  import java.io.BufferedOutputStream;
  import java.net.Socket;
  import java.net.URL;
  import java.util.Hashtable;
  import java.util.Vector;
  import java.util.StringTokenizer;
  
  /**
   * Interface from XML-RPC to a 'lite' HTTP implementation.  This class will use
   * the XmlRpcClientLite.auth member for the HTTP Basic authentication string.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: LiteXmlRpcTransport.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  class LiteXmlRpcTransport implements XmlRpcTransport
  {
      String hostname;
      String host;
      int port;
      String uri;
      Socket socket = null;
      BufferedOutputStream output;
      BufferedInputStream input;
      boolean keepalive;
      byte[] buffer;
  
      /**
       * Create a new DefaultXmlRpcTransport with the specified URL.
       *
       * @param url the url to POST XML-RPC requests to.
       */
      public LiteXmlRpcTransport(URL url)
      {
          hostname = url.getHost();
          port = url.getPort();
          if (port < 1)
          {
              port = 80;
          }
          uri = url.getFile();
          if (uri == null || "".equals(uri))
          {
              uri = "/";
          }
          host = port == 80 ? hostname : hostname + ":" + port;        
      }
  
      public InputStream sendXmlRpc(byte [] request)
      throws IOException
      {
          try
          {
              if (socket == null)
              {
                initConnection();
              }
  
              InputStream in = null;
  
             // send request to the server and get an input stream
             // from which to read the response
              try
              {
                  in = sendRequest(request);
              }
              catch (IOException iox)
              {
                  // if we get an exception while sending the request,
                  // and the connection is a keepalive connection, it may
                  // have been timed out by the server. Try again.
                  if (keepalive)
                  {
                      closeConnection();
                      initConnection();
                      in = sendRequest(request);
                  }
                  else
                  {
                      throw iox;
                  }
              }
  
              // eepalive is always false if XmlRpc.keepalive is false
              if (!keepalive)
              {
                  closeConnection ();
              }
  
              return in;
          }
          catch (IOException iox)
          {
              // this is a lower level problem,  client could not talk to
              // server for some reason.
              throw iox;
          }
          catch (Exception x)
          {
              // same as above, but exception has to be converted to
              // IOException.
              if (XmlRpc.debug)
              {
                  x.printStackTrace ();
              }
  
              String msg = x.getMessage ();
              if (msg == null || msg.length () == 0)
              {
                  msg = x.toString ();
              }
              throw new IOException (msg);
          }
      }
  
      /**
       *
       * @throws IOException
       */
      protected void initConnection() throws IOException
      {
          socket = new Socket(hostname, port);
          output = new BufferedOutputStream(socket.getOutputStream());
          input = new BufferedInputStream(socket.getInputStream());
      }
  
      /**
       *
       */
      protected void closeConnection ()
      {
          try
          {
              socket.close();
          }
          catch (Exception ignore)
          {
          }
          finally
          {
              socket = null;
          }
      }
  
      /**
       *
       * @param request
       * @return
       * @throws IOException
       */
      public InputStream sendRequest(byte[] request) throws IOException
      {
          output.write(("POST " + uri + " HTTP/1.0\r\n").getBytes());
          output.write(("User-Agent: " + XmlRpc.version + "\r\n").getBytes());
          output.write(("Host: " + host + "\r\n").getBytes());
          if (XmlRpc.getKeepAlive())
          {
              output.write("Connection: Keep-Alive\r\n".getBytes());
          }
          output.write("Content-Type: text/xml\r\n".getBytes());
          if (XmlRpcClientLite.auth != null)
          {
              output.write(("Authorization: Basic " + XmlRpcClientLite.auth + "\r\n")
                      .getBytes());
          }
          output.write(("Content-Length: " + request.length)
                  .getBytes());
          output.write("\r\n\r\n".getBytes());
          output.write(request);
          output.flush();
  
          // start reading  server response headers
          String line = readLine();
          if (XmlRpc.debug)
          {
              System.out.println(line);
          }
          int contentLength = -1;
          try
          {
              StringTokenizer tokens = new StringTokenizer(line);
              String httpversion = tokens.nextToken();
              String statusCode = tokens.nextToken();
              String statusMsg = tokens.nextToken("\n\r");
              keepalive = XmlRpc.getKeepAlive()
                      && "HTTP/1.1".equals(httpversion);
              if (! "200".equals(statusCode))
              {
                  throw new IOException("Unexpected Response from Server: "
                          + statusMsg);
              }
          }
          catch (IOException iox)
          {
              throw iox;
          }
          catch (Exception x)
          {
              // x.printStackTrace ();
              throw new IOException("Server returned invalid Response.");
          }
          do
          {
              line = readLine ();
              if (line != null)
              {
                  if (XmlRpc.debug)
                  {
                      System.out.println(line);
                  }
                  line = line.toLowerCase();
                  if (line.startsWith("content-length:"))
                  {
                      contentLength = Integer.parseInt(
                              line.substring(15).trim());
                  }
                  if (line.startsWith("connection:"))
                  {
                      keepalive = XmlRpc.getKeepAlive()
                              && line.indexOf("keep-alive") > -1;
                  }
              }
          }
          while (line != null && ! line.equals(""))
              ;
          return new ServerInputStream(input, contentLength);
      }
  
      /**
       *
       * @return
       * @throws IOException
       */
      private String readLine() throws IOException
      {
          if (buffer == null)
          {
              buffer = new byte[2048];
          }
          int next;
          int count = 0;
          while (true)
          {
              next = input.read();
              if (next < 0 || next == '\n')
              {
                  break;
              }
              if (next != '\r')
              {
                  buffer[count++] = (byte) next;
              }
              if (count >= buffer.length)
              {
                  throw new IOException ("HTTP Header too long");
              }
          }
          return new String(buffer, 0, count);
      }
  
      /**
       *
       * @throws Throwable
       */
      protected void finalize() throws Throwable
      {
          closeConnection ();
      }
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientException.java
  
  Index: XmlRpcClientException.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2001 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /**
   * This is thrown by many of the client classes if an error occured processing
   * and XML-RPC request or response due to client side processing. This exception
   * will wrap a cause exception in the JDK 1.4 style.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcClientException.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public class XmlRpcClientException extends XmlRpcException
  {
      /**
       * The underlying cause of this exception.
       */
      public Throwable cause;
  
      /**
       * Create an XmlRpcClientException with the given message and
       * underlying cause exception.
       *
       * @param message the message for this exception.
       * @param cause the cause of the exception.
       */
      public XmlRpcClientException(String message, Throwable cause)
      {
          super(0, message);
          this.cause = cause;
      }
  
      /**
       * Returns the cause of this throwable or null if the cause is nonexistent
       * or unknown. (The cause is the throwable that caused this throwable to
       * get thrown.)
       * 
       * This implementation returns the cause that was supplied via the constructor,
       * according to the rules specified for a "legacy chained throwable" that
       * predates the addition of chained exceptions to Throwable.
       *
       * See the <a
       * href="http://java.sun.com/j2se/1.4.1/docs/api/java/lang/Throwable.html";>JDK
       * 1.4 Throwable documentation</a> for more information.
       */
      public Throwable getCause()
      {
          return cause;
      }
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientRequest.java
  
  Index: XmlRpcClientRequest.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright(c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation(http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Vector;
  
  /**
   * Interface to an XML-RPC request made by a client.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcClientRequest.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public interface XmlRpcClientRequest
  {
      public String getMethodName();
      public int getParameterCount();
      public Object getParameter(int index);
  }
  
  
  
  1.1                  
xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientRequestProcessor.java
  
  Index: XmlRpcClientRequestProcessor.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright(c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation(http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.IOException;
  import java.io.OutputStream;
  import java.io.ByteArrayOutputStream;
  import java.util.Vector;
  
  /**
   * Process an XML-RPC client request into a byte array or directly onto
   * an OutputStream.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcClientRequestProcessor.java,v 1.1 2002/12/05 08:49:24 aevers 
Exp $
   * @since 1.2
   */
  public class XmlRpcClientRequestProcessor
  {
      /**
       * Encode a request from the XmlClientRpcRequest implementation to an
       * output stream in the specified character encoding.
       *
       * @param request the request to encode.
       * @param encoding the Java name for the encoding to use.
       * @return byte [] the encoded request.
       */
      public void encodeRequest(XmlRpcClientRequest request, String encoding, 
OutputStream out)
      throws XmlRpcClientException, IOException
      {
          XmlWriter writer;
  
          writer = new XmlWriter(out, encoding);
         
          writer.startElement("methodCall");
          writer.startElement("methodName");
          writer.write(request.getMethodName());
          writer.endElement("methodName");
          writer.startElement("params");
  
          int l = request.getParameterCount();
          for (int i = 0; i < l; i++)
          {
              writer.startElement("param");
              writer.writeObject(request.getParameter(i));
              writer.endElement("param");
          }
          writer.endElement("params");
          writer.endElement("methodCall");
          writer.flush();
      }
  
      /**
       * Encode a request from the XmlRpcClientRequest implementation to a
       * byte array representing the XML-RPC call, in the specified character
       * encoding.
       *
       * @param request the request to encode.
       * @param encoding the Java name for the encoding to use.
       * @return byte [] the encoded request.
       */
      public byte [] encodeRequestBytes(XmlRpcClientRequest request, String encoding)
      throws XmlRpcClientException
      {
          ByteArrayOutputStream buffer;
  
          try
          {
              buffer = new ByteArrayOutputStream();
              encodeRequest(request, encoding, buffer);
              return buffer.toByteArray();
          }
          catch (IOException ioe)
          {
              throw new XmlRpcClientException("Error occured encoding XML-RPC 
request", ioe);
          }
      }
  
      /**
       * Called by the worker management framework to see if this object can be
       * re-used. Must attempt to clean up any state, and return true if it can
       * be re-used.
       *
       * @return boolean true if this objcet has been cleaned up and may be re-used.
       */
      protected boolean canReUse()
      {
          return true;
      }
  }
  
  
  
  1.1                  
xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientResponseProcessor.java
  
  Index: XmlRpcClientResponseProcessor.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright(c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation(http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Hashtable;
  import java.io.InputStream;
  
  import org.xml.sax.AttributeList;
  import org.xml.sax.SAXException;
  
  /**
   * Process an XML-RPC server response from a byte array or an
   * InputStream into an Object. Optionally throw the result object
   * if it is an exception.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcClientResponseProcessor.java,v 1.1 2002/12/05 08:49:24 aevers 
Exp $
   * @since 1.2
   */
  public class XmlRpcClientResponseProcessor extends XmlRpc
  {
      /** The result of the XML-RPC operation. Possibly an XmlRpcException */
      protected Object result;
  
      /** Set to true if a fault occured on the server. */
      protected boolean fault;
  
      /**
       * Decode an XML-RPC response from the specified InputStream. This
       * method will parse the input and return an Object. The result
       * will be an XmlRpcException if the server returned a fault, or
       * an Object if the server returned a result.
       *
       * @param is the stream to read from.
       * @return Object an XmlRpcException if an error occured, or the response.
       */
      public Object decodeResponse(InputStream is)
      throws XmlRpcClientException
      {
          result = null;
          fault = false;
          try
          {
              parse(is);
              if (fault)
              {
                  return decodeException(result);
              }
              else
              {
                  return result;
              }
          }
          catch (Exception x)
          {
              throw new XmlRpcClientException("Error decoding XML-RPC response", x);
          }
      }
  
      /**
       * Decode an exception from the result returned from the remote server.
       * This method both returns and throws an XmlRpcException. If it returns an
       * XmlRpcException then that is the exception thrown on the remote side. If
       * it throws an exception then an exception occured locally when decoding
       * the response
       *
       * @param result the result from the remote XML-RPC server.
       * @throws XmlRpcClientException if the result could not be processed.
       * @return XmlRpcException the processed response from the server.
       */
      protected XmlRpcException decodeException(Object result)
      throws XmlRpcClientException
      {
          Hashtable exceptionData;
          
          try
          {
              exceptionData = (Hashtable) result; 
              return new XmlRpcException(
                  Integer.parseInt(exceptionData.get("faultCode").toString()),
                  (String) exceptionData.get("faultString")
              );
          }
          catch (Exception x)
          {
              throw new XmlRpcClientException("Error decoding XML-RPC exception 
response", x);
          }
      }
  
      protected void objectParsed(Object what)
      {
          result = what;
      }
  
      /**
       * Overrides method in XmlRpc to handle fault repsonses.
       */
      public void startElement(String name, AttributeList atts)
              throws SAXException
      {
          if ("fault".equals(name))
          {
              fault = true;
          }
          else
          {
              super.startElement(name, atts);
          }
      }
  
      /**
       * Called by the worker management framework to see if this worker can be
       * re-used. Must attempt to clean up any state, and return true if it can
       * be re-used.
       *
       * @return boolean true if this worker has been cleaned up and may be re-used.
       */
      protected boolean canReUse()
      {
          result = null;
          fault = false;
          return true;
      }
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcClientWorker.java
  
  Index: XmlRpcClientWorker.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright(c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation(http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.InputStream;
  import java.io.IOException;
  
  /**
   * Tie together the XmlRequestProcessor and XmlResponseProcessor to handle
   * a request serially in a single thread.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @since 1.2
   */
  public class XmlRpcClientWorker
  {
      protected XmlRpcClientRequestProcessor requestProcessor;
      protected XmlRpcClientResponseProcessor responseProcessor;
  
      public XmlRpcClientWorker()
      {
          this(new XmlRpcClientRequestProcessor(), 
               new XmlRpcClientResponseProcessor()
          );
      }
  
      public XmlRpcClientWorker(XmlRpcClientRequestProcessor requestProcessor,
                                XmlRpcClientResponseProcessor responseProcessor)
      {
          this.requestProcessor = requestProcessor;
          this.responseProcessor = responseProcessor;
      }
  
      public Object execute(XmlRpcClientRequest xmlRpcRequest, XmlRpcTransport 
transport)
      throws XmlRpcException, XmlRpcClientException, IOException
      {
          long now = 0;
        Object response;
  
          if (XmlRpc.debug)
          {
              now = System.currentTimeMillis();
          }
  
          try
          {
              byte [] request = requestProcessor.encodeRequestBytes(xmlRpcRequest, 
responseProcessor.getEncoding());
              InputStream is  = transport.sendXmlRpc(request);
              response = responseProcessor.decodeResponse(is);
              if (response instanceof XmlRpcException)
              {
                throw (XmlRpcException) response;
              }
              else
              {
                return response;
              }
          }
          catch (IOException ioe)
          {
              throw ioe;
          }
          catch (XmlRpcClientException xrce)
          {
              throw xrce;
          }
          catch (XmlRpcException xre)
          {
              throw xre;
          }
          catch (Exception x)
          {
              if (XmlRpc.debug)
              {
                  x.printStackTrace();
              }
              throw new XmlRpcClientException("Unexpected exception in client 
processing.", x);
          }
          finally
          {
              if (XmlRpc.debug)
              {
                  System.out.println("Spent " + (System.currentTimeMillis() - now)
                                     + " millis in request/process/response");
              }
          }
      }
  
      /**
       * Called by the worker management framework to see if this worker can be
       * re-used. Must attempt to clean up any state, and return true if it can
       * be re-used.
       *
       * @return boolean true if this worker has been cleaned up and may be re-used.
       */
      protected boolean canReUse()
      {
          return responseProcessor.canReUse() && requestProcessor.canReUse();
      }
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcServerRequest.java
  
  Index: XmlRpcServerRequest.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright(c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation(http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.util.Vector;
  
  /**
   * Interface to an XML-RPC request made to the server.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcServerRequest.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public interface XmlRpcServerRequest
  {
      public Vector getParameters();
      public Object getParameter(int index);
      public String getMethodName();
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcTransport.java
  
  Index: XmlRpcTransport.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.InputStream;
  import java.io.IOException;
  
  /**
   * Interface from XML-RPC to an underlying transport, most likely base on HTTP.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Hannes Wallnoefer</a>
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcTransport.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public interface XmlRpcTransport
  {
    public InputStream sendXmlRpc(byte [] request)
    throws IOException, XmlRpcClientException;
  }
  
  
  
  1.1                  xml-rpc/src/java/org/apache/xmlrpc/XmlRpcTransportFactory.java
  
  Index: XmlRpcTransportFactory.java
  ===================================================================
  package org.apache.xmlrpc;
  
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2002 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "XML-RPC" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  import java.io.InputStream;
  import java.io.IOException;
  
  /**
   * Interface from XML-RPC to an underlying transport, most likely base on HTTP.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]";>Andrew Evers</a>
   * @version $Id: XmlRpcTransportFactory.java,v 1.1 2002/12/05 08:49:24 aevers Exp $
   * @since 1.2
   */
  public interface XmlRpcTransportFactory
  {
    public XmlRpcTransport createTransport();
  }
  
  
  


Reply via email to