This commit is contained in:
Lucio Lelii 2018-09-24 13:21:20 +00:00
parent 3cc5d58351
commit 6c68b6c142
3 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,5 @@
package org.gcube.common.storagehub.client.plugins;
import javax.ws.rs.client.WebTarget;
import javax.xml.transform.dom.DOMResult;
import javax.xml.ws.EndpointReference;

View File

@ -22,6 +22,7 @@ import org.gcube.common.gxrest.response.inbound.GXInboundResponse;
import org.gcube.common.storagehub.client.StreamDescriptor;
import org.gcube.common.storagehub.model.acls.ACL;
import org.gcube.common.storagehub.model.acls.AccessType;
import org.gcube.common.storagehub.model.exceptions.BackendGenericError;
import org.gcube.common.storagehub.model.items.Item;
import org.gcube.common.storagehub.model.service.ItemList;
import org.gcube.common.storagehub.model.service.ItemWrapper;
@ -341,10 +342,12 @@ public class DefaultItemManager implements ItemManagerClient {
formData.add("description", description);
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.TEXT_PLAIN_TYPE).post(Entity.form(formData));
GXInboundResponse response = myManager.setAcceptedResponseType(MediaType.APPLICATION_FORM_URLENCODED_TYPE).post(Entity.entity(formData, MediaType.APPLICATION_FORM_URLENCODED));
if (response.hasGXError())
if (response.hasGXError() || response.hasException())
throw response.getException();
if (response.hasErrorCode())
throw new BackendGenericError();
return response.getSource().readEntity(String.class);
}

View File

@ -82,7 +82,7 @@ public class TestCall {
WorkspaceManagerClient client = AbstractPlugin.workspace().build();
Item ws = client.getWorkspace();
String id = itemclient.createFolder(ws.getId(), "ok6SharingTest", "shared folder for test SHM");
String id = itemclient.createFolder(ws.getId(), "ok7SharingTest", "shared folder for test SHM");
String sharedId = itemclient.shareFolder(id, new HashSet<String>(Arrays.asList("giancarlo.panichi")), AccessType.WRITE_OWNER);
itemclient.uploadFile(new FileInputStream("/home/lucio/Downloads/upload.pdf"), sharedId, "sharedFile.pdf" , "shared file in a shared folder");