Thursday, January 14, 2010

Can you believe Java API's can fool you sometimes?

Recently I run into an issue with streaming large files (specifically PDF files) from WebSphere application server (version 5.x and 6.x). I have a servlet that reads a large file (300 MB) from Application server and stream the bytes to the browser. naturally i have used a buffered output stream and used a buffer size as 1024 bytes. and every time 1024 bytes is written to the servlet output stream i used the "flush" API to clear the buffer and thinking it may send the bytes immediately to the browser. But unfortunately I have observed a strange error! can you guess what could be that?