minor fixes on create resources with multipart
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-catalogue/catalogue-ws@148368 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3052887f9d
commit
04792a90e4
|
@ -1053,12 +1053,13 @@ public class CatalogueUtils {
|
|||
File file = upload.getValueAs(File.class);
|
||||
long fileLenghtBytes = file.length();
|
||||
long fileLenghtMegaByte = fileLenghtBytes >> 20;
|
||||
logger.debug("File lenght in MegaByte is " + fileLenghtMegaByte);
|
||||
logger.debug("File lenght in MegaByte is " + fileLenghtMegaByte);
|
||||
|
||||
if(fileLenghtMegaByte > MAX_UPLOADABLE_FILE_SIZE_MB)
|
||||
throw new Exception("Exceeding maximum uploadable file size!");
|
||||
if(fileLenghtMegaByte > MAX_UPLOADABLE_FILE_SIZE_MB)
|
||||
throw new Exception("Exceeding maximum uploadable file size!");
|
||||
|
||||
}
|
||||
}else
|
||||
throw new Exception("No 'upload' field has been provided!");
|
||||
|
||||
Client client = ClientBuilder.newClient();
|
||||
client.register(MultiPartFeature.class);
|
||||
|
|
|
@ -71,8 +71,12 @@ public class Resource {
|
|||
logger.info(fields);*/
|
||||
|
||||
Caller caller = AuthorizationProvider.instance.get();
|
||||
String context = ScopeProvider.instance.get();
|
||||
return CatalogueUtils.delegatePost(caller, context, Constants.RESOURCE_CREATE, multiPart, uriInfo);
|
||||
String context = ScopeProvider.instance.get();
|
||||
try{
|
||||
return CatalogueUtils.delegatePost(caller, context, Constants.RESOURCE_CREATE, multiPart, uriInfo);
|
||||
}catch(Exception e){
|
||||
return CatalogueUtils.createJSONOnFailure(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue