+
+
+ @GetMapping("seen")
+ public Map<Integer, Map<String, Map<String, Long>>> seen()
+ {
+ return wordcount.getSeen();
+ }
+
+ @GetMapping("seen/{user}")
+ public ResponseEntity<Map<String, Long>> seen(@PathVariable String user)
+ {
+ for (Map<String, Map<String, Long>> users : wordcount.getSeen().values())
+ {
+ Map<String, Long> words = users.get(user);
+ if (words != null)
+ return ResponseEntity.ok(words);
+ }
+
+ return ResponseEntity.notFound().build();
+ }
+
+
+ @ExceptionHandler
+ @ResponseStatus(HttpStatus.BAD_REQUEST)
+ public ErrorResponse illegalStateException(IllegalStateException e)
+ {
+ return new ErrorResponse(e.getMessage(), HttpStatus.BAD_REQUEST.value());
+ }