I have a problem with outputstream, I have this Java Spring code:
@RequestMapping(value="/downloadZip", produces="application/zip") public void downloadZip(HttpSession session,HttpServletResponse response) throws IOException { OutputStream out = response.getOutputStream(); FileInputStream in = new FileInputStream(FileManager.EXPORT_FOLDER + File.separator + FileManager.EXPORT_FILE); byte[] buffer = new byte[4096]; int length; while ((length = in.read(buffer)) > 0){ out.write(buffer, 0, length); } in.close(); out.flush(); response.flushBuffer(); } The "file" that i'm exporting it's a ZIP file with other two files in it. The thing is that I call from the front this api to download the zip file, and it downloads ok, but with no extension and with other name that i don't have in anywhere of the application, it's like, the FileManager.EXPORT_FILE name is "FileToDownload.zip" and when i download the file it's called "file" and that "file" name i don't have it anywhere and when i uncompress that file it's good, but i need the extension, any clues?
Thanks a lot!