removed validation and doHead
git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/data-transfer/uri-resolver@173726 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c8ccd7f5b4
commit
afbc94f335
|
@ -1,24 +1,18 @@
|
||||||
package org.gcube.datatransfer.resolver.services;
|
package org.gcube.datatransfer.resolver.services;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.ws.rs.GET;
|
import javax.ws.rs.GET;
|
||||||
import javax.ws.rs.HEAD;
|
|
||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.PathParam;
|
import javax.ws.rs.PathParam;
|
||||||
import javax.ws.rs.QueryParam;
|
import javax.ws.rs.QueryParam;
|
||||||
import javax.ws.rs.WebApplicationException;
|
import javax.ws.rs.WebApplicationException;
|
||||||
import javax.ws.rs.client.Entity;
|
|
||||||
import javax.ws.rs.core.Response;
|
import javax.ws.rs.core.Response;
|
||||||
import javax.ws.rs.core.Response.ResponseBuilder;
|
import javax.ws.rs.core.Response.ResponseBuilder;
|
||||||
import javax.ws.rs.core.Response.Status;
|
import javax.ws.rs.core.Response.Status;
|
||||||
import javax.ws.rs.core.StreamingOutput;
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
|
||||||
import org.apache.http.HttpStatus;
|
|
||||||
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
import org.gcube.contentmanagement.blobstorage.resource.MyFile;
|
||||||
import org.gcube.contentmanagement.blobstorage.service.IClient;
|
import org.gcube.contentmanagement.blobstorage.service.IClient;
|
||||||
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
|
import org.gcube.contentmanager.storageclient.wrapper.AccessType;
|
||||||
|
@ -97,10 +91,10 @@ public class StorageManager {
|
||||||
//Checking mandatory parameter smpId
|
//Checking mandatory parameter smpId
|
||||||
if(smpId==null || smpId.isEmpty()){
|
if(smpId==null || smpId.isEmpty()){
|
||||||
logger.error(SMP_ID+" not found");
|
logger.error(SMP_ID+" not found");
|
||||||
return Response.status(400).entity(Entity.text("Missing mandatory parameter "+SMP_ID)).build();
|
//return Response.status(400).entity(Entity.text("Missing mandatory parameter "+SMP_ID)).build();
|
||||||
|
throw new WebApplicationException("Missing mandatory parameter "+SMP_ID, Status.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.warn("Sono qui getSMPID");
|
|
||||||
return getStorageId(smpId, fileName, contentType, validation);
|
return getStorageId(smpId, fileName, contentType, validation);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -127,8 +121,10 @@ public class StorageManager {
|
||||||
throw new WebApplicationException("Missing mandatory parameter "+STORAGE_ID, Status.BAD_REQUEST);
|
throw new WebApplicationException("Missing mandatory parameter "+STORAGE_ID, Status.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(validation!=null && validation)
|
if(validation!=null && validation)
|
||||||
return validationPayload(storageId);
|
return validationPayload(storageId);
|
||||||
|
*/
|
||||||
|
|
||||||
StorageClient client = getStorageClientInstance(storageId);
|
StorageClient client = getStorageClientInstance(storageId);
|
||||||
String toSEID = null;
|
String toSEID = null;
|
||||||
|
@ -154,7 +150,9 @@ public class StorageManager {
|
||||||
|
|
||||||
MyFile file = iClient.getMetaFile().RFile(toSEID);
|
MyFile file = iClient.getMetaFile().RFile(toSEID);
|
||||||
logger.debug("MetaFile retrieved from storage? "+ (file!=null));
|
logger.debug("MetaFile retrieved from storage? "+ (file!=null));
|
||||||
fileName= file.getName();
|
//Reading the fileName from Storage Metadata only if the passed fileName is null
|
||||||
|
if(fileName==null || fileName.isEmpty())
|
||||||
|
fileName= file.getName();
|
||||||
|
|
||||||
//Reading the contentType from Storage Metadata only if the passed contentType is null
|
//Reading the contentType from Storage Metadata only if the passed contentType is null
|
||||||
if(contentType==null || contentType.isEmpty())
|
if(contentType==null || contentType.isEmpty())
|
||||||
|
@ -193,7 +191,7 @@ public class StorageManager {
|
||||||
* @throws ServletException the servlet exception
|
* @throws ServletException the servlet exception
|
||||||
* @throws IOException Signals that an I/O exception has occurred.
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
*/
|
*/
|
||||||
@HEAD
|
/*@HEAD
|
||||||
@Path("{storage-id}")
|
@Path("{storage-id}")
|
||||||
public Response httpDoHead(@PathParam(STORAGE_ID) String storageId, @QueryParam(HPROXYCHECK) Boolean hproxycheck) throws ServletException, IOException {
|
public Response httpDoHead(@PathParam(STORAGE_ID) String storageId, @QueryParam(HPROXYCHECK) Boolean hproxycheck) throws ServletException, IOException {
|
||||||
logger.info("doHead working..");
|
logger.info("doHead working..");
|
||||||
|
@ -206,7 +204,7 @@ public class StorageManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
return validationPayload(storageId);
|
return validationPayload(storageId);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,7 +213,7 @@ public class StorageManager {
|
||||||
* @param storageId the storage id
|
* @param storageId the storage id
|
||||||
* @return the response
|
* @return the response
|
||||||
*/
|
*/
|
||||||
protected Response validationPayload(String storageId){
|
/*protected Response validationPayload(String storageId){
|
||||||
|
|
||||||
//Checking to STORAGE-ID Resolver
|
//Checking to STORAGE-ID Resolver
|
||||||
if (storageId == null || storageId.isEmpty()) {
|
if (storageId == null || storageId.isEmpty()) {
|
||||||
|
@ -261,7 +259,7 @@ public class StorageManager {
|
||||||
throw new WebApplicationException("Error on validating the file with id: "+storageId, Status.INTERNAL_SERVER_ERROR);
|
throw new WebApplicationException("Error on validating the file with id: "+storageId, Status.INTERNAL_SERVER_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue