Search in sources :

Example 1 with FileInfo

use of com.haulmont.restapi.data.FileInfo in project cuba by cuba-platform.

the class FileUploadController method createFileInfoResponseEntity.

protected ResponseEntity<FileInfo> createFileInfoResponseEntity(HttpServletRequest request, FileDescriptor fd) {
    FileInfo fileInfo = new FileInfo(fd.getId(), fd.getName(), fd.getSize());
    UriComponents uriComponents = UriComponentsBuilder.fromHttpUrl(request.getRequestURL().toString()).path("/{id}").buildAndExpand(fd.getId().toString());
    HttpHeaders httpHeaders = new HttpHeaders();
    httpHeaders.setLocation(uriComponents.toUri());
    return new ResponseEntity<>(fileInfo, httpHeaders, HttpStatus.CREATED);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) UriComponents(org.springframework.web.util.UriComponents) ResponseEntity(org.springframework.http.ResponseEntity) FileInfo(com.haulmont.restapi.data.FileInfo)

Aggregations

FileInfo (com.haulmont.restapi.data.FileInfo)1 HttpHeaders (org.springframework.http.HttpHeaders)1 ResponseEntity (org.springframework.http.ResponseEntity)1 UriComponents (org.springframework.web.util.UriComponents)1