|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object redstone.xmlrpc.XmlRpcSerializer redstone.xmlrpc.XmlRpcJsonSerializer
public class XmlRpcJsonSerializer
The XmlRpcJsonSerializer class converts Java objects to their JSON counterparts. It inherently supports basic object types like String, Integer, Double, Float, Boolean, Date, and byte arrays. For other types of objects, custom serializers need to be registered. The Redstone XML-RPC library comes with a set of useful serializers for collections and other types of objects. @see the redstone.xmlrpc.serializers.json . Although this is not what you would expect to find in an XML-RPC library, implementing a JSON serializer required very little effort and gives great value for JavaScript clients that wants to use XML-RPC services in their AJAX implementations. It is easy to create XML-RPC compatible messages in JavaScript but less easy to parse the response which is not required using this format, just use eval( responseText ) to get a JavaScript object. TODO Change synchronization of global dateFormatter to prevent bottleneck.
Constructor Summary | |
---|---|
XmlRpcJsonSerializer()
Constructor adding all core custom serializers. |
|
XmlRpcJsonSerializer(boolean addCustomSerializers)
Constructor that may add all the custom serializers in the library (which is almost always what you want). |
Method Summary | |
---|---|
void |
serialize(java.lang.Object value,
java.io.Writer writer)
Overrides the default serializing mechanism to use JSON format instead. |
void |
writeEnvelopeFooter(java.lang.Object value,
java.io.Writer writer)
Overrides the default serializing mechanism to use JSON format instead. |
void |
writeEnvelopeHeader(java.lang.Object value,
java.io.Writer writer)
Overrides the default serializing mechanism to use JSON format instead. |
void |
writeError(java.lang.String message,
java.io.Writer writer)
Overrides the default serializing mechanism to use JSON format instead. |
Methods inherited from class redstone.xmlrpc.XmlRpcSerializer |
---|
addCustomSerializer, removeCustomSerializer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlRpcJsonSerializer()
public XmlRpcJsonSerializer(boolean addCustomSerializers)
addCustomSerializers
- Indicates if the core custom serializers should be added.Method Detail |
---|
public void writeEnvelopeHeader(java.lang.Object value, java.io.Writer writer) throws java.io.IOException
writeEnvelopeHeader
in class XmlRpcSerializer
java.io.IOException
public void writeEnvelopeFooter(java.lang.Object value, java.io.Writer writer) throws java.io.IOException
writeEnvelopeFooter
in class XmlRpcSerializer
java.io.IOException
public void writeError(java.lang.String message, java.io.Writer writer) throws java.io.IOException
writeError
in class XmlRpcSerializer
java.io.IOException
public void serialize(java.lang.Object value, java.io.Writer writer) throws XmlRpcException, java.io.IOException
serialize
in class XmlRpcSerializer
XmlRpcException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |