This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In my web application, I need to provide functionality to enable downloading of a file from the server using a servlet. After having provided that functionality by means of the following code,
I now need to display progress/status as to whats happening on the server side. The file being downloaded is a result of a few operations like generating pdfs and merging them. This takes quite some time and until then the client is left in the dark and all he can does is stare at a blank browser window. So as to enrich user experience I wanted to show progress of the files being merged and also the size of the end file that has been downloaded before it finally opens on the browser window, Is this possible and is there any particular pattern to follow.
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." <br />Linus Torvalds
I do this by kicking off the long running process in a new thread and then immediately returning the user to a status page. The status page refreshes itself (using a META tag) every n seconds to check with server. If the job is not done, I return the status page. Once it's finished, I stream the file or forward to a page with a link to the file.