Conditions | 1 |
Total Lines | 17 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | package com.osomapps.pt.admin.user; |
||
24 | @GetMapping(value = "{id}/{fileName}") |
||
25 | @ResponseBody |
||
26 | Object findOne( |
||
27 | @PathVariable Long id, @PathVariable String fileName, HttpServletResponse response) |
||
28 | throws IOException { |
||
29 | try (FastByteArrayOutputStream outputStream = new FastByteArrayOutputStream()) { |
||
30 | final ProgramResponseDTO programResponseDTO = |
||
31 | userProgramFileService.createXlsx(id, outputStream); |
||
32 | response.setContentType(programResponseDTO.getFileType()); |
||
33 | response.setHeader( |
||
34 | "Content-disposition", |
||
35 | "attachment; filename=" + programResponseDTO.getFileName()); |
||
36 | outputStream.writeTo(response.getOutputStream()); |
||
37 | response.getOutputStream().close(); |
||
38 | outputStream.reset(); |
||
39 | } |
||
40 | return null; |
||
41 | } |
||
43 |