Advertisement
Guest User

Untitled

a guest
Jan 4th, 2015
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.53 KB | None | 0 0
  1. @RequestMapping(value = "download/{name}", method = RequestMethod.GET)
  2.     public void getFileByName(@PathVariable("name") final String name, HttpServletResponse response) throws IOException {
  3.         response.setContentType("audio/mpeg3");
  4.         response.setHeader("Content-Disposition", "attachment; filename=" + name);
  5.         service.callSomeMethodAndRecieveDownloadedFileInSomeForm(name); // <- and this file(InputStream/OutputStream/byte[] array/File object/MultipartFile I dont really know..) has to be sent to the user
  6.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement