Advertisement
Guest User

Untitled

a guest
Nov 19th, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.             try {
  2.                 Path path = Paths.get("ARQUIVO");
  3.                 byte[] data = Files.readAllBytes(path);
  4.  
  5.                 HttpServletResponse httpServletResponse = response.raw();
  6.  
  7.                 httpServletResponse.setContentType("application/pdf");
  8.                 httpServletResponse.addHeader("Content-Disposition", "inline; filename=mypdf.pdf");
  9.                 httpServletResponse.getOutputStream().write(data);
  10.                 httpServletResponse.getOutputStream().close();
  11.             } catch (IOException e) {
  12.                 e.printStackTrace();
  13.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement