Bug #3142
openmetacat client uses in-memory buffer for posting data
0%
Description
The size of XML files (and probably data files) that can be sent to metacat is memory limited in client applications because the MetacatClient implementation assumes the payload can be loaded into a memory buffer before it is sent. This is done to calculate the size of the payload before POSTing it. We need new insert(), update(), and upload() methods that take a size parameter so that the Reader or InputStream can be streamed directly over the http connection instead of being accumulated in an in-memory buffer.
We have code that does this in Morpho already using Apache's httpclient library, but this should make its way into MetacatClient. With JDK after 1.5.x, Sun's http protocol handler now supports streaming POSTs, but you have to set up a separate HttpURLConnection with a new protocol handler and call setFixedLengthStreamingMode(). See:
http://java.sun.com/j2se/1.5.0/docs/api/java/net/HttpURLConnection.html#setFixedLengthStreamingMode(int
This would be an alternative to using httpclient, but probably still requires registering a newly configured protocol handler.
We also may have trouble with Metacat, because it also reads data using a string, as described in bug # 1122.