chemistry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Naresh Bhatia <bhat...@comcast.net>
Subject Re: Returning content stream in HttpServletResponse
Date Mon, 13 Jun 2011 16:25:00 GMT
One followup question - returning pdf documents in HttpServletResponse is
working fine, however I am seeing a strange phenomenon when downloading
video files. When the browser sees Content-Type: video/mp4 in the response,
it automatically sends multiple other GET requests asking for the same file!
So I have up to 4 streams being streamed to the browser for a single file.
Why is this happening? I notice this with Chrome and Safari only, not with
Firefox. All browsers still end up showing the video, except for Safari on
iPad which gives this error “The Server is not correctly configured”.

I know this is not a CMIS question but Googling did not help. I am hoping
someone on this list has hit this issue.

Thanks.

Naresh



On Sat, Jun 4, 2011 at 7:10 AM, Florian Müller <florian.mueller@alfresco.com
> wrote:

> 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.
>
>
> Cheers,
>
> Florian
>
>
> ----- Original Message -----
> From: "Naresh Bhatia" <bhatian@comcast.net>
> To: "dev" <dev@chemistry.apache.org>
> 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(
>        document.getContentStream().getStream());
>
> BufferedOutputStream dst = new BufferedOutputStream(
>        response.getOutputStream());
>
> byte[] buff = new byte[2048];
> int bytesRead;
> while((bytesRead = src.read(buff, 0, buff.length)) != -1) {
>    dst.write(buff, 0, bytesRead);
> }
>
>
> Thanks.
> Naresh
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message