Skip to content

Instantly share code, notes, and snippets.

@edwise
Last active August 29, 2015 14:15
Show Gist options
  • Save edwise/86017cfb42740f77de27 to your computer and use it in GitHub Desktop.
Save edwise/86017cfb42740f77de27 to your computer and use it in GitHub Desktop.
How to do a RESTful POST without Spring Hateoas (link)
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setLocation(
ServletUriComponentsBuilder
.fromCurrentRequest()
.path("/{id}")
.buildAndExpand(entity.getId())
.toUri());
return new ResponseEntity<>(httpHeaders, HttpStatus.CREATED);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment