Vote count:
0
What's the equivalent of this code using springboot-web for creating resources and returning 201 with the resource URL?
@RequestMapping(method = RequestMethod.POST)
@ResponseStatus(HttpStatus.CREATED)
Widget create(@RequestBody @Valid Widget wid) {
return service.create(wid);
}
This is the shortest example I found in Jersey; for successful POST, the response has to be built manually?
@POST @Path("widget")
Response create(@RequestBody @Valid Widget wid) {
return Response
.status(Response.Status.CREATED)
.entity("new widget created")
.header("Location","http://localhost:7001/widget"+wid)
.build();
}
asked 38 secs ago
Equivalent of springboot web HttpStatus.CREATED in Jersey?
Aucun commentaire:
Enregistrer un commentaire