I have 2 webpage (java spring 2.5, MVC) name "web 1" and "web 2".
- At "web 1", I have a controller name "controller 1".
this controller will return a zip file to client, and allow client to download zip file.
----code controller 1-------
-----------------------------Code:@Controller public class TransferFile { @RequestMapping("/transfer.ws") public ModelAndView TransferZipFile(HttpServletRequest request, HttpServletResponse response) throws Exception { String zipFileName = "zipfile.zip"; String zipFilePath = "c:/" + zipFileName; InputStream in = new FileInputStream(zipFilePath); response.setContentType("application/download"); response.setHeader("Content-Disposition", "attachment; filename=\"" + zipFileName + "\""); response.setContentLength(in.available()); ServletOutputStream op = response.getOutputStream(); int length = 0; byte[] buf = new byte[1024]; while ((in != null) && ((length = in.read(buf)) != -1)) { op.write(buf, 0, length); } in.close(); op.flush(); op.close(); return null; } }
I was check download file ok.
- At "web 2", i have a controller name "controller 2".
this controller will call link of "controller 1", and saving zip file of "controller 1" to driver c.
----------
I was try, but i can't saving zip file to driver c.
Please help me.
Thanks you very much.


Reply With Quote
..
