On 15 Apr 2005, at 11:43, Henri Gomez wrote:
XmlRpcServer provide an execute method which return a byte[] buffer, ie :
public byte[] execute(InputStream is)
It will be very usefull when embedding XML-RPC in a servlet engine, ie Tomcat, to use directly the servlet OutputStream which could be possible with a method like this :
public int execute(InputStream is, OutputStream os)
XML-RPC is not well suited to dealing with very large payloads. The specification requires that the content-length header is used which means that the entire request or response has to be assembled in memory before it is sent (i.e. you can't use chunked encoding). In addition the Apache XML-RPC implementation uses the Apache Commons Base64 codec to encode and decode byte[] values. This has no way of dealing with byte streams so implementing your suggestion in a way which saves memory would be a very extensive job. As a rule of thumb I have found that you need free contiguous heap memory of four times the size of the array when you are receiving it and three times the size of the array when sending it.
If you are transferring large amounts of binary data you might consider sending a URL which points to the data and then doing a GET on the URL.
John Wilson The Wilson Partnership http://www.wilson.co.uk