The browsers are probably using Content-Range headers to specify a subset of the stream.
Florent On Mon, Jun 13, 2011 at 6:25 PM, Naresh Bhatia <[email protected]> wrote: > 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 <[email protected] >> 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" <[email protected]> >> To: "dev" <[email protected]> >> 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 >> > -- Florent Guillaume, Director of R&D, Nuxeo Open Source, Java EE based, Enterprise Content Management (ECM) http://www.nuxeo.com http://www.nuxeo.org +33 1 40 33 79 87
