Spring REST - create .zip file and send it to the client

后端 未结 4 959
借酒劲吻你
借酒劲吻你 2020-12-04 21:25

I want to create .zip file that contains my zipped files that I recieve from backend, and then send this file to the user. For 2 days I have been looking for the answer and

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 22:26

    seems to be solved. I replaced:

    response.setContentType("application/zip");
    

    with:

    @RequestMapping(value = "/zip", produces="application/zip")
    

    And now I get clear, beautiful .zip file :)

    If any of you have either better or faster proposition, or just want to give some advice, then go ahead, I am curious.

提交回复
热议问题