org.apache.xmlrpc

Class 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.
Authors:
Andrew Evers
Hannes Wallnoefer
Daniel L. Rall
Since:
1.2

Field Summary

private static byte[]
EMPTY_BYTE_ARRAY

Constructor Summary

XmlRpcResponseProcessor()
Creates a new instance.

Method Summary

byte[]
encodeException(Exception x, String encoding)
Process an exception, and return output in the specified encoding.
byte[]
encodeException(Exception x, String encoding, int code)
Process an exception, and return output in the specified encoding.
byte[]
encodeResponse(Object responseParam, String encoding)
Process a successful response, and return output in the specified encoding.
(package private) void
writeError(int code, String message, XmlWriter writer)
Writes an XML-RPC error response to the XML writer.
(package private) void
writeResponse(Object param, XmlWriter writer)
Writes an XML-RPC response to the XML writer.

Field Details

EMPTY_BYTE_ARRAY

private static final byte[] EMPTY_BYTE_ARRAY

Constructor Details

XmlRpcResponseProcessor

public XmlRpcResponseProcessor()
Creates a new instance.

Method Details

encodeException

public byte[] encodeException(Exception x,
                              String encoding)
Process an exception, and return output in the specified encoding.
Parameters:
encoding - The output encoding.
Returns:
byte[] The XML-RPC response.

encodeException

public byte[] encodeException(Exception x,
                              String encoding,
                              int code)
Process an exception, and return output in the specified encoding.
Parameters:
encoding - The output encoding.
code - The XML-RPC faultCode.
Returns:
byte[] The XML-RPC response.

encodeResponse

public byte[] encodeResponse(Object responseParam,
                             String encoding)
            throws IOException,
                   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.

writeError

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

writeResponse

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

Copyright B) 1999-2002 Apache Software Foundation. All Rights Reserved.