Conditions | 1 |
Total Lines | 14 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | package com.osomapps.pt.exercises; |
||
24 | @GetMapping("{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 ExerciseImageDTO exerciseImageDTO = |
||
31 | exerciseImageService.findOne(id, fileName, outputStream); |
||
32 | response.setContentType(exerciseImageDTO.getFileType()); |
||
33 | outputStream.writeTo(response.getOutputStream()); |
||
34 | response.getOutputStream().close(); |
||
35 | outputStream.reset(); |
||
36 | } |
||
37 | return null; |
||
38 | } |
||
40 |