Esempio n. 1
0
 @RequestMapping(
     value = {"/ws/1.0/request"},
     method = RequestMethod.POST,
     produces = "application/json",
     consumes = "application/json")
 @SuppressWarnings("ThrowableResultIgnored")
 public ResponseEntity<ReportResponse> request(@RequestBody(required = true) ReportRequest req) {
   ReportTask res = reportService.request(req);
   return ResponseEntity.status(res.getStatus().getHttpStatus()).body(res.getResponse());
 }
Esempio n. 2
0
 @RequestMapping(
     value = {"/ws/1.0/output/{requestId}"},
     method = RequestMethod.GET)
 public ResponseEntity<byte[]> output(@PathVariable("requestId") String requestId)
     throws IOException {
   try {
     byte[] output = reportService.output(requestId);
     ReportTask task = reportService.detail(requestId);
     logManager.info("output :" + requestId);
     return ResponseEntity.status(HttpStatus.OK)
         .contentType(ReportOutputFormat.valueOf(task.getRequest().getExtension()).getMediaType())
         .lastModified(task.getEnded())
         .header(
             "Content-Disposition",
             "inline; filename=" + requestId + "." + task.getRequest().getExtension())
         .body(output);
   } catch (NoSuchElementException e) {
     logManager.info("output :YOK !!! " + requestId);
     return ResponseEntity.status(HttpStatus.NOT_FOUND).body(null);
   }
 }