Blame view

src/main/java/fr/plil/sio/web/mvc/UserRestController.java 794 Bytes
d0481dcb   Julien Cartigny   Support for user ...
1
2
  package fr.plil.sio.web.mvc;
  
f9b4ae49   jcartign   Fix recursion in ...
3
  import org.springframework.web.bind.annotation.PathVariable;
d0481dcb   Julien Cartigny   Support for user ...
4
5
6
7
8
9
10
11
12
13
14
15
16
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.RestController;
  
  import javax.annotation.Resource;
  import java.util.List;
  
  @RestController
  public class UserRestController {
  
      @Resource
      private UserService userService;
  
f9b4ae49   jcartign   Fix recursion in ...
17
      @RequestMapping(value = "/api/users/", method = RequestMethod.GET)
d0481dcb   Julien Cartigny   Support for user ...
18
19
20
      public List<User> listUsers() {
          return userService.findAll();
      }
f9b4ae49   jcartign   Fix recursion in ...
21
22
23
24
25
  
      @RequestMapping(value = "/api/users/{username}/", method = RequestMethod.GET)
      public User listUsers(@PathVariable String username) {
          return userService.findByUsername(username);
      }
d0481dcb   Julien Cartigny   Support for user ...
26
  }