开发者

Monitor download progress with apache http components

开发者 https://www.devze.com 2022-12-20 22:28 出处:网络
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 dow

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. Obtain the Content-Length response header first
  2. Get the result as stream and process it byte-by-byte (in batches)
  3. Count the bytes processed and show the user the percentage of processed bytes from the total number of bytes (obtained on the 1st step)
0

精彩评论

暂无评论...
验证码 换一张
取 消