This content has been marked as final. Show 2 replies
Our application serves pdf file over the web.This how we do pdf streaming
1.browser sends a request for a pdf file
2.Our application adds a header Accpet-Ranges which servers like a flag by which browser understands that this server can send response in byte ranges(streaming).
3.Jboss sends the header set by our application along with so many other headers to browser. Jboss tries to send some pdf content
4. As soon as Browser sees the flag and it sends request to Jboss to send pdf content in ranges of bytes .browser can request for any rangesof bytes withing contnet length of file.One request may have multiple byte range requests
4.Jboss sends the requested bytes to browser.
Though streaming happens when we open Pdf , sometimes intial appearance of pdf in the browser take a longer time.
To debug this problem we used a http sniffer and tried to open some other pdfs avilable over internet.This what we found by tracking our application and other pdfs in inetrnet
a.PDfs over the internet opens up faster than our application pdfs over internet.
b.reason is those server sends only few thousands of bytes and responds to byte range req from browser.
c.But jboss application server we use tries to send few hunderd thousand bytes before it services the byte range request from browser.this makes the initial pdf appearance slow.
Note:the req and resp header of inetrepdfs are same as what we set in our application .
I think modifying tomcat DefaultServlet , to send only some thousand bytes and service byte range requests as soon as they are recieved , will fix the problem.