org.apache.xmlrpc
Class XmlRpcResponseProcessor

java.lang.Object
  extended by org.apache.xmlrpc.XmlRpcResponseProcessor

public class XmlRpcResponseProcessor
extends java.lang.Object

Process an Object and produce byte array that represents the specified encoding of the output as an XML-RPC response. This is NOT thread safe.

Since:
1.2
Author:
Andrew Evers, Hannes Wallnoefer, Daniel L. Rall

Constructor Summary
XmlRpcResponseProcessor()
          Creates a new instance.
 
Method Summary
 byte[] encodeException(java.lang.Exception x, java.lang.String encoding)
          Process an exception, and return output in the specified encoding.
 byte[] encodeException(java.lang.Exception x, java.lang.String encoding, int code)
          Process an exception, and return output in the specified encoding.
 byte[] encodeResponse(java.lang.Object responseParam, java.lang.String encoding)
          Process a successful response, and return output in the specified encoding.
(package private)  void writeError(int code, java.lang.String message, XmlWriter writer)
          Writes an XML-RPC error response to the XML writer.
(package private)  void writeResponse(java.lang.Object param, XmlWriter writer)
          Writes an XML-RPC response to the XML writer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcResponseProcessor

public XmlRpcResponseProcessor()
Creates a new instance.

Method Detail

encodeResponse

public byte[] encodeResponse(java.lang.Object responseParam,
                             java.lang.String encoding)
                      throws java.io.IOException,
                             java.io.UnsupportedEncodingException,
                             XmlRpcException
Process a successful response, and return output in the specified encoding.

Parameters:
responseParam - The response to process.
encoding - The output encoding.
Returns:
byte[] The XML-RPC response.
Throws:
java.io.IOException
java.io.UnsupportedEncodingException
XmlRpcException

encodeException

public byte[] encodeException(java.lang.Exception x,
                              java.lang.String encoding,
                              int code)
Process an exception, and return output in the specified encoding.

Parameters:
e - The exception to process;
encoding - The output encoding.
code - The XML-RPC faultCode.
Returns:
byte[] The XML-RPC response.

encodeException

public byte[] encodeException(java.lang.Exception x,
                              java.lang.String encoding)
Process an exception, and return output in the specified encoding.

Parameters:
e - The exception to process;
encoding - The output encoding.
Returns:
byte[] The XML-RPC response.

writeResponse

void writeResponse(java.lang.Object param,
                   XmlWriter writer)
             throws XmlRpcException,
                    java.io.IOException
Writes an XML-RPC response to the XML writer.

Throws:
XmlRpcException
java.io.IOException

writeError

void writeError(int code,
                java.lang.String message,
                XmlWriter writer)
          throws XmlRpcException,
                 java.io.IOException
Writes an XML-RPC error response to the XML writer.

Throws:
XmlRpcException
java.io.IOException


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