Skip to content

Instantly share code, notes, and snippets.

View vdjurovic's full-sized avatar

Vladimir Djurovic vdjurovic

View GitHub Profile
@vdjurovic
vdjurovic / page.css
Created November 18, 2015 06:58
HTML/CSS to simulate A4 pagr printing view
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: #FAFAFA;
font: 12pt "Tahoma";
}
* {
box-sizing: border-box;
/**
* 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);