| Line 25... |
Line 25... |
| 25 |
public class FofoController {
|
25 |
public class FofoController {
|
| 26 |
|
26 |
|
| 27 |
private static final Logger LOGGER = LoggerFactory.getLogger(FofoController.class);
|
27 |
private static final Logger LOGGER = LoggerFactory.getLogger(FofoController.class);
|
| 28 |
|
28 |
|
| 29 |
@Autowired
|
29 |
@Autowired
|
| 30 |
Mongo mongoClient;
|
30 |
private Mongo mongoClient;
|
| 31 |
|
31 |
|
| 32 |
@Autowired
|
32 |
@Autowired
|
| 33 |
FofoDocumentsGenerator generator;
|
33 |
private FofoDocumentsGenerator generator;
|
| 34 |
|
34 |
|
| 35 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET)
|
35 |
@RequestMapping(value = "/fofo", method = RequestMethod.GET)
|
| 36 |
public String getAll(HttpServletRequest request, Model model) throws Exception {
|
36 |
public String getAll(HttpServletRequest request, Model model) throws Throwable {
|
| 37 |
model.addAttribute("fofoForms", mongoClient.getFofoForms(0, 50));
|
37 |
model.addAttribute("fofoForms", mongoClient.getFofoForms(0, 50));
|
| 38 |
return "fofo-index";
|
38 |
return "fofo-index";
|
| 39 |
}
|
39 |
}
|
| 40 |
|
40 |
|
| 41 |
@RequestMapping(value = "/fofo/{fofoId}/file-display", method = RequestMethod.GET)
|
41 |
@RequestMapping(value = "/fofo/{fofoId}/file-display", method = RequestMethod.GET)
|
| 42 |
public ResponseEntity<byte[]> displayDocs(HttpServletRequest request, @PathVariable(name = "fofoId") int fofoId) throws Exception{
|
42 |
public ResponseEntity<byte[]> displayDocs(HttpServletRequest request, @PathVariable(name = "fofoId") int fofoId) throws Throwable{
|
| 43 |
HttpHeaders headers = new HttpHeaders();
|
43 |
HttpHeaders headers = new HttpHeaders();
|
| 44 |
headers.setContentType(MediaType.parseMediaType("application/pdf"));
|
44 |
headers.setContentType(MediaType.parseMediaType("application/pdf"));
|
| 45 |
String filename = "output.pdf";
|
45 |
String filename = "output.pdf";
|
| 46 |
headers.setContentDispositionFormData(filename, filename);
|
46 |
headers.setContentDispositionFormData(filename, filename);
|
| 47 |
headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
|
47 |
headers.setCacheControl("must-revalidate, post-check=0, pre-check=0");
|