You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Rodrigo Ruiz <rr...@gridsystems.com> on 2003/12/16 15:06:07 UTC

Attachments memory consumption

Hi all,

I am currently designing some libraries for transfering files through 
web services. I will provide different services, depending on the client 
code requirements.

For example, I have already developed a simple web service that receives 
/ returns the file contents as a Base64 encoded string. I have also an 
optional servlet that accepts PUT requests, so I can upload large files 
without worrying about memory consumption on the server side.

Now, I would like to implement an attachment version of my upload / 
download service, but I have some doubts: looking at the Axis code, I 
have seen that, at least MIME attachments, seem to be read into a 
ByteArrayOuputStream. Is there any way to tell Axis to write the 
incoming attachment directly on disk, without buffering the whole 
contents in memory? Is there any difference in this sense between DIME 
and MIME implementations?

My idea was to improve large files support with respect to my first 
low-level service (the one using the Base64 encoded string), but if 
attachments are still being fully read into memory, I cannot use them 
for large files.

I am also planning a different approach: a web service providing methods 
for opening, closing, and read/write byte blocks. The idea is to create 
RemoteFileInputStream and RemoteFileOutputStream classes that wrapping 
my web service stubs will provide me the same interface as a local file 
in client applications. Anybody has been working in something similar? I 
would appreciate any comments on this idea :-)

Thanks in advance,
Rodrigo Ruiz