i try to register custom Serializers like in marquee
Can someone give me an example how to do this?
Cannot make a static reference to the non-static method addCustomSerializer(XmlRpcCustomSerializer) from the type XmlRpcSerializer
the VectorSerializers is implementation of XmlRpcCustomSerializer
Each XmlRpcServer has its own instance of XmlRpcSerializer. So in order to add extra serializers to a particulat XmlRpcServer you need to get its serializer instance first:
Note though, that the built-in serializer can already serialize vectors since it includes a custom collection serializer, and Vector is an implementation of Collection.
The following custom serializers are added by default:
redstone.xmlrpc.serializers.CollectionSerializer <-- this handles Vector too
Hope this helps.
A slight correction, java.util.Vector also implements the java.util.List interface, in addition to the Collection interface. So it is in fact the redstone.xmlrpc.serializers.ListSerializer that will serialize any Vector objects you have in your requests or responses, since the ListSerializer is included before the CollectionSerializer in the built-in list of custom serializers.
The result is the same though, any Vector parameters you have in your server, or send through an XmlRpcClient will be serialized without you having to include your own VectorSerializer.
Would be good to be able to add custom serializers on the XmlRpcClient/XmlRpcProxy, but from looking at the source code, this does not seem possible.
Log in to post a comment.