开发者

let user resume download of files from a web page?

开发者 https://www.devze.com 2023-02-12 08:32 出处:网络
we will have large files (up to 2 Gb) files on a web page, and want to have the开发者_JAVA技巧 functionality that the user can continue a download if it gets interrupted.

we will have large files (up to 2 Gb) files on a web page, and want to have the开发者_JAVA技巧 functionality that the user can continue a download if it gets interrupted.

At the moment, the only solution i can come up with is a java applet, i have tried searching for any existing open source projects with this functionality but havent found any so far.

Would be thankful for any tips how to achieve this, or pointers to existing projects or documentation that can be useful.

I am open to any solutions, so it does not have to be java applet (important is that it works in the most common browsers)


You could serve it as a torrent instead of a simple file and let the user's BitTorrent client figure it out.

Assuming you don't want to do that, HTTP lets the client specify a range of bytes to download. The user's browser has to be able to recognize that the file the user wants to download is the same as the one that already exists in partial form and send the proper range headers to the server, and server has to honor them. You can probably take care of the server side, but the browser will have to hold up its end. Some "download manager" programs do this too.

For more information:

http://www.west-wind.com/Weblog/posts/244.aspx


What you need is a Java Download Manager 


1. An open Source project exist in google 
    http://code.google.com/p/jdownloadmon/
    HTTPDownloadConnection.java#method connect 
2. What partial content range types this server supports    
     Accept-Ranges: bytes
     http://en.wikipedia.org/wiki/List_of_HTTP_header_field
    Accept Range will allow the user to pause and resume download.        
3.http://stackoverflow.com/questions/3414438/java-resume-download-in-urlconnection
0

精彩评论

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