chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florian Müller <>
Subject Re: Returning content stream in HttpServletResponse
Date Sat, 04 Jun 2011 11:10:30 GMT
That should work fine if you use the AtomPub binding. It pulls the bytes directly from the
underlying repository. The Web Services binding buffers the stream. If the content is <=4MB
it is buffered in main memory. If it is >4MB it is buffered in a temporary file. (This
threshold can be changed by a session parameter.) The temporary file adds significant overhead
for large contents, but it still should work.

I have tested it with content up to 1GB. If you have something bigger than that please let
us know if it works or doesn't work.



----- Original Message -----
From: "Naresh Bhatia" <>
To: "dev" <>
Sent: Saturday, June 4, 2011 12:54:35 AM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Returning content stream in HttpServletResponse

I would like to return the content of a document in a HttpServletResponse.
What I have right now is shown below. Is there a better way? Will this scale
for large video content?

InputStream src = new BufferedInputStream(

BufferedOutputStream dst = new BufferedOutputStream(

byte[] buff = new byte[2048];
int bytesRead;
while((bytesRead =, 0, buff.length)) != -1) {
    dst.write(buff, 0, bytesRead);


View raw message