5

I am going to write an application server(RESTFull API) to allow clients to download a zip file, but requirement is the download must be resume-able (due to failure / Network disconnection).

Is there any special protocol made for this???

If yes please share some contents on this, I am not even able to find anything on google. I am trying to do this in Java(jersey). Thanks

user7116
  • 63,008
  • 17
  • 141
  • 172
Mubashar
  • 12,300
  • 11
  • 66
  • 95
  • 1
    Duplicate: http://stackoverflow.com/questions/6237079/resume-http-file-download-in-java – user423430 Jul 29 '11 at 13:52
  • 1
    Thanks for comment, however it seems to be a client side discussion, whereas I am looking for advice if i need any particular implementation on server side (host of file to download). – Mubashar Jul 30 '11 at 11:12
  • http://stackoverflow.com/questions/5011446/java-server-side-sending-file-with-resume-support – user423430 Aug 01 '11 at 14:36

1 Answers1

8

There's no special protocol you need to know about for resumable downloads. HTTP defines the "Range" header. Clients use the Range header to specify which parts of a file they want to download.

Resumable downloads are implemented by keeping track of which parts of the file you have downloaded, and if interrupted, resuming where you left off.

Server-side, you usually only need to care about whether the asset being served is dynamic or static.

If it's static, the solution is usually as simple as making sure that your web server (Apache or whatever) has the Range header turned on and letting clients have at it.

If it's dynamic, you have to check for the presence of a Range header in the incoming HTTP request and then ensuring that you only serve the requested portion of the asset. There are some additional things to consider such as versioning, caching, etc. which I won't go into but hopefully you get the idea.

Hope that helps!

bitops
  • 4,022
  • 3
  • 26
  • 31