Class DogController

java.lang.Object
edu.ucsb.cs156.example.controllers.ApiController
edu.ucsb.cs156.example.controllers.DogController

@RequestMapping("/api/dogs") @RestController public class DogController extends ApiController
  • Constructor Details

    • DogController

      public DogController()
  • Method Details

    • allDogs

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("/all") public Iterable<Dog> allDogs()
    • getById

      @PreAuthorize("hasRole(\'ROLE_USER\')") @GetMapping("") public Dog getById(@RequestParam Long id)
    • postDog

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PostMapping("/post") public Dog postDog(@RequestParam String name, @RequestParam String breed) throws com.fasterxml.jackson.core.JsonProcessingException
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException
    • deleteDog

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @DeleteMapping("") public Object deleteDog(@RequestParam Long id)
    • updateDog

      @PreAuthorize("hasRole(\'ROLE_ADMIN\')") @PutMapping("") public Dog updateDog(@RequestParam Long id, @RequestBody @Valid @Valid Dog incoming)