explicit HEAD method

This commit is contained in:
FabioISTI 2020-04-08 16:05:43 +02:00
parent 3aeeec686b
commit f6953c3c46
1 changed files with 13 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.HEAD;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@ -26,6 +27,7 @@ import org.gcube.data.transfer.model.DeletionReport;
import org.gcube.data.transfer.model.Destination;
import org.gcube.data.transfer.model.DestinationClashPolicy;
import org.gcube.data.transfer.model.PluginInvocation;
import org.gcube.data.transfer.model.RemoteFileDescriptor;
import org.gcube.data.transfer.model.ServiceConstants;
import org.gcube.data.transfer.model.TransferRequest;
import org.gcube.data.transfer.model.TransferTicket;
@ -193,6 +195,17 @@ public class REST {
}
}
@HEAD
@Produces(MediaType.APPLICATION_JSON)
public RemoteFileDescriptor getDescriptor() {
String pathString="<"+destinationID+">/"+subPath;
try {
log.info("Received HEAD request at {} , descriptor option is {} ",pathString);
return persistence.getDescriptor(destinationID, subPath);
}catch(DestinationAccessException e) {
throw new WebApplicationException("Unable to access selected path "+pathString,e,Status.INTERNAL_SERVER_ERROR);
}
}
@DELETE
@Produces(MediaType.APPLICATION_JSON)