示例#1
0
 /** GET /users -> get all users. */
 @RequestMapping(
     value = "/users",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 public List<User> getAll() {
   log.debug("REST request to get all Users");
   return userRepository.findAll();
 }
示例#2
0
 /** GET /users/:login -> get the "login" user. */
 @RequestMapping(
     value = "/users/{login}",
     method = RequestMethod.GET,
     produces = MediaType.APPLICATION_JSON_VALUE)
 @Timed
 ResponseEntity<User> getUser(@PathVariable String login) {
   log.debug("REST request to get User : {}", login);
   return userRepository
       .findOneByLogin(login)
       .map(user -> new ResponseEntity<>(user, HttpStatus.OK))
       .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
 }