use of com.haulmont.restapi.data.CreatedEntityInfo in project cuba by cuba-platform.
the class EntitiesController method createEntity.
@PostMapping("/{entityName}")
public ResponseEntity<String> createEntity(@RequestBody String entityJson, @PathVariable String entityName, @RequestParam(required = false) String modelVersion, HttpServletRequest request) {
CreatedEntityInfo entityInfo = entitiesControllerManager.createEntity(entityJson, entityName, modelVersion);
UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl(request.getRequestURL().toString()).path("/{id}").buildAndExpand(entityInfo.getId().toString());
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.setLocation(uriComponents.toUri());
return new ResponseEntity<>(entityInfo.getJson(), httpHeaders, HttpStatus.CREATED);
}
Aggregations