Created
March 17, 2017 02:51
-
-
Save cjvirtucio87/6af77712fd4a5b273cefc187ece9ddb0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
User user = getAuthenticatedUser(); | |
FileInfo fileInfo = InfoFactory.createFileInfo( | |
uploadLength, | |
uploadMetadata, | |
user != null ? user.getUsername() : "", | |
null | |
); | |
Store store = fileStoreUtil.getStore(fileInfo); | |
store = (store == null) ? fileStoreUtil.createStore(fileInfo) : store; | |
HttpHeaders responseHeaders = new HttpHeaders(); | |
responseHeaders.setLocation(new URI(store.getURI())); | |
responseHeaders.set("New-Offset", store.getFileOffset().toString()); | |
return new ResponseEntity<>("", responseHeaders, HttpStatus.CREATED); | |
} catch (Exception e) { | |
return ResponseEntity.badRequest() | |
.headers(HeaderUtil.createAlert(ENTITY_NAME,"failed creation")) | |
.build(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment