Skip to content

Instantly share code, notes, and snippets.

@garystafford
Created January 27, 2016 02:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/a3749281f72ced8dd17c to your computer and use it in GitHub Desktop.
Save garystafford/a3749281f72ced8dd17c to your computer and use it in GitHub Desktop.
@RequestMapping(path = "/names", method = RequestMethod.GET)
public Collection<String> getReservationNames() {
ParameterizedTypeReference<Resources<Reservation>> ptr =
new ParameterizedTypeReference<Resources<Reservation>>() {};
return this.restTemplate.exchange("http://reservation-service/reservations", GET, null, ptr)
.getBody()
.getContent()
.stream()
.map(Reservation::getReservationName)
.collect(toList());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment