com.flat502.rox.marshal.xmlrpc
Class XmlRpcMethodFault

java.lang.Object
  extended by com.flat502.rox.marshal.xmlrpc.XmlRpcMethod
      extended by com.flat502.rox.marshal.xmlrpc.XmlRpcMethodResponse
          extended by com.flat502.rox.marshal.xmlrpc.XmlRpcMethodFault
All Implemented Interfaces:
RpcFault, RpcMethod, RpcResponse, XmlRpcConstants

public class XmlRpcMethodFault
extends XmlRpcMethodResponse
implements RpcFault

An instance of this class represents an XML-RPC method call fault.

The relationship between Java and XML-RPC data types is discussed in the description of the XmlRpcMethod class.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.flat502.rox.marshal.xmlrpc.XmlRpcConstants
XmlRpcConstants.ContentTypes, XmlRpcConstants.Formats, XmlRpcConstants.Tags, XmlRpcConstants.Types
 
Constructor Summary
XmlRpcMethodFault(int faultCode, java.lang.String faultString)
           
XmlRpcMethodFault(int faultCode, java.lang.Throwable fault)
           
XmlRpcMethodFault(java.lang.Throwable fault)
           
 
Method Summary
 int getFaultCode()
          Get the fault code for this RPC fault.
 java.lang.String getFaultString()
          Get the fault string describing the fault code and the fault in more detail.
protected  void marshalImpl(XmlPrinter out)
          The central hook for marshalling for sub-classes.
protected  Fault newFault(int faultCode, java.lang.String faultString)
          Constructs a new instance of Fault initialized with the given fault code and fault string.
protected  java.lang.String toFaultString(java.lang.Throwable exception)
          Converts an exception into a String value for use as a fault string
 
Methods inherited from class com.flat502.rox.marshal.xmlrpc.XmlRpcMethodResponse
getReturnValue
 
Methods inherited from class com.flat502.rox.marshal.xmlrpc.XmlRpcMethod
getContentType, getHttpMethod, getHttpURI, marshal, marshal, marshal, marshal, marshalValue, setCompactXml
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.flat502.rox.marshal.RpcResponse
getReturnValue
 
Methods inherited from interface com.flat502.rox.marshal.RpcMethod
getContentType, marshal
 

Constructor Detail

XmlRpcMethodFault

public XmlRpcMethodFault(java.lang.Throwable fault)

XmlRpcMethodFault

public XmlRpcMethodFault(int faultCode,
                         java.lang.Throwable fault)

XmlRpcMethodFault

public XmlRpcMethodFault(int faultCode,
                         java.lang.String faultString)
Method Detail

marshalImpl

protected void marshalImpl(XmlPrinter out)
                    throws MarshallingException,
                           java.io.IOException
Description copied from class: XmlRpcMethod
The central hook for marshalling for sub-classes.

Implementations should write their marshalled form to the given stream which has already been initialized with an appropriate encoding.

Overrides:
marshalImpl in class XmlRpcMethodResponse
Parameters:
out - The stream implementations should marshal themselves to.
Throws:
MarshallingException - Implementations may raise an exception if a problem occurs while marshalling is being attempted.
java.io.IOException - Implementations may raise an exception if a problem occurs while writing the marshalled form of this instance out.

getFaultString

public java.lang.String getFaultString()
Description copied from interface: RpcFault
Get the fault string describing the fault code and the fault in more detail.

Fault strings are implementation-dependent. In general fault codes should be used for programmatic handling of faults and fault strings for display only.

Specified by:
getFaultString in interface RpcFault
Returns:
The fault string for this RPC fault.

getFaultCode

public int getFaultCode()
Description copied from interface: RpcFault
Get the fault code for this RPC fault.

Fault codes are implementation-dependent.

Specified by:
getFaultCode in interface RpcFault
Returns:
The fault code for this RPC fault.

toFaultString

protected java.lang.String toFaultString(java.lang.Throwable exception)
Converts an exception into a String value for use as a fault string

This method exists so that sub-classes can customize how the fault string is derived from an exception.

Parameters:
exception - The exception to convert.
Returns:
A String value suitable for use as a fault string.

newFault

protected Fault newFault(int faultCode,
                         java.lang.String faultString)
Constructs a new instance of Fault initialized with the given fault code and fault string.

This factory method is exposed so that implementations can return a sub-class of Fault that may be more useful in their context.

Parameters:
faultCode - The fault code to initialize the instance with.
faultString - The fault string to initialize the instance with.
Returns:
An instance of Fault (or a sub-class) suitably initialized.