This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
padding: 0; | |
background-color: #FAFAFA; | |
font: 12pt "Tahoma"; | |
} | |
* { | |
box-sizing: border-box; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Spring controller method using async features.Controller method to handle POST.requests. It will set 'Location' header and set HTTP status to 201. | |
*/ | |
@RequestMapping(method = RequestMethod.POST, consumes = {MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_XML_VALUE}) | |
public Callable<ResponseEntity<Void>> userSignup(@RequestBody User user, HttpServletResponse response, HttpServletRequest request) { | |
return () -> { | |
String id = userService.createUser(user); | |
HttpHeaders headers = new HttpHeaders(); | |
headers.setLocation(new URI("http://myhost.com/users/id/" + id))); | |
return new ResponseEntity<>(headers, HttpStatus.CREATED); |