|
|
|
@ -2,7 +2,6 @@ package org.gcube.gcat.workspace;
|
|
|
|
|
|
|
|
|
|
import java.net.HttpURLConnection;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import org.gcube.common.gxhttp.request.GXHTTPStringRequest;
|
|
|
|
@ -36,8 +35,8 @@ public class CatalogueStorageHubManagement {
|
|
|
|
|
this.storageHubManagement = new StorageHubManagement();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected String getOriginalFileName(HttpURLConnection httpURLConnection) throws ParseException {
|
|
|
|
|
String contentDisposition = httpURLConnection.getHeaderFields().get("content-disposition").get(0);
|
|
|
|
|
protected String getOriginalFileName(HttpURLConnection httpURLConnection) throws Exception {
|
|
|
|
|
String contentDisposition = httpURLConnection.getHeaderField("Content-Disposition");
|
|
|
|
|
contentDisposition = contentDisposition.replaceAll("= ", "=").replaceAll(" =", "=");
|
|
|
|
|
ContentDisposition formDataContentDisposition = new ContentDisposition(contentDisposition);
|
|
|
|
|
return formDataContentDisposition.getFileName();
|
|
|
|
@ -60,6 +59,9 @@ public class CatalogueStorageHubManagement {
|
|
|
|
|
metadata);
|
|
|
|
|
mimeType = storageHubManagement.getMimeType();
|
|
|
|
|
return persistedURL;
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
logger.error("Error while trying to persists the resource", e);
|
|
|
|
|
throw e;
|
|
|
|
|
} finally {
|
|
|
|
|
applicationMode.end();
|
|
|
|
|
}
|
|
|
|
|