예제 #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.PUT)
 @ResponseStatus(HttpStatus.OK)
 public void update(@PathVariable("id") final Long id, @RequestBody final Foo resource) {
   Preconditions.checkNotNull(resource);
   RestPreconditions.checkFound(service.findOne(resource.getId()));
   service.update(resource);
 }
예제 #2
0
  @RequestMapping(value = "/{id}", method = RequestMethod.GET)
  @ResponseBody
  public Foo findById(@PathVariable("id") final Long id, final HttpServletResponse response) {
    final Foo resourceById = RestPreconditions.checkFound(service.findOne(id));

    eventPublisher.publishEvent(new SingleResourceRetrievedEvent(this, response));
    return resourceById;
  }