Skip to content

Instantly share code, notes, and snippets.

@khill
Created March 14, 2012 03:00
Show Gist options
  • Select an option

  • Save khill/2033689 to your computer and use it in GitHub Desktop.

Select an option

Save khill/2033689 to your computer and use it in GitHub Desktop.
Showing how to stream an image back from a Spring MVC Controller
@RequestMapping("/minuteGraph.htm")
public ResponseEntity <byte []> getUpdatesByMinuteGraph() {
HttpStatus responseCode = HttpStatus.OK;
byte [] image = new byte[0];
Map <String,Long> updatesByMinute = reportDao.loadUpdateCountsByMinute(15);
try {
image = this.getUpdateCountByMinuteGraph(updatesByMinute);
} catch (Exception e) {
responseCode = HttpStatus.INTERNAL_SERVER_ERROR;
}
return new ResponseEntity<byte[]>(image, responseCode);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment