I have some big files to download with Apache's Http Components and I want to be able to display some progress info to users in the admin console of my web app. What is the right way to monitor a download in progress using this library? I will create a singleton to manage the ongoing downloads, what I need is a way to inspect the open connections and find out where they are at any given time.
+1
A:
- Obtain the
Content-Length
response header first - Get the result as stream and process it byte-by-byte
- Count the bytes processed and show the user the percentage of processed bytes from the total number of bytes (obtained on the 1st step)
Bozho
2010-02-24 11:18:43
I was hoping for something more magical.. but this works just fine and really didn't require as much code as I thought it might.. pretty simple really.
danb
2010-03-05 15:32:00