简体   繁体   中英

Partial file is being downloaded from tomcat service

I'm trying to download a file of size 50mb in the browser (chrome) using rest api of service running in tomcat. In the server I'm using httpservletresponse's output stream to write the file contents. Sometime, only partial file is being downloaded (less than 50MB) even though server returns 200 response code.

Here are my question,

  1. Does server response 200 indicates successful file download or it just indicates that my request was processed and it has nothing to do with complete file download. Or server should return different status code if file is downloaded partially.
  2. What could be reasons for partial file download.

Response 200 is the standard response for successful HTTP requests . The actual response depends on the request's content (and method as well); in your case it means that the server understood your request, which you're authorized to submit and successfully completed its task (which seems to be sending the file).

Possible errors are many: an error in reading the file (have you checked that it is readable?), an error in your application not returning the correct response size and so on...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM