Horje
POST method) in spring rest api Code Example
POST method) in spring rest api
@PostMapping("/rest/v1/books")public ResponseEntity<Book> addBook(@RequestBody Book book) throws URISyntaxException {    try {        Book newBook = bookService.save(book);        return ResponseEntity.created(new URI("/rest/v1/books/" + newBook.getId()))                .body(book);    } catch (ResourceAlreadyExistsException ex) {        // log exception first, then return Conflict (409)        logger.error(ex.getMessage());        return ResponseEntity.status(HttpStatus.CONFLICT).build();    } catch (BadResourceException ex) {        // log exception first, then return Bad Request (400)        logger.error(ex.getMessage());        return ResponseEntity.status(HttpStatus.BAD_REQUEST).build();    }}




Java

Related
maths.random in Java Code Example maths.random in Java Code Example
javafx rectangle border size Code Example javafx rectangle border size Code Example
spring Code Example spring Code Example
how to draw a rectangle in libgdx Code Example how to draw a rectangle in libgdx Code Example
put arraylist in hashtable java Code Example put arraylist in hashtable java Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8