Created
March 14, 2012 03:00
-
-
Save khill/2033689 to your computer and use it in GitHub Desktop.
Showing how to stream an image back from a Spring MVC Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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