git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/branches/data-transfer/data-transfer-service/2.0@160651 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
3194959b9e
commit
34e9e8c34f
|
@ -144,7 +144,7 @@ public class REST {
|
||||||
}
|
}
|
||||||
case HTTPDownload :{
|
case HTTPDownload :{
|
||||||
if(sourceID==null) throw new WebApplicationException("Parameter "+ServiceConstants.SOURCE_ID+" is mandatory.",Status.BAD_REQUEST);
|
if(sourceID==null) throw new WebApplicationException("Parameter "+ServiceConstants.SOURCE_ID+" is mandatory.",Status.BAD_REQUEST);
|
||||||
destination.setDestinationFileName(destinationFileName==null?sourceID:destinationFileName);
|
if(destinationFileName!=null)destination.setDestinationFileName(destinationFileName);
|
||||||
try{
|
try{
|
||||||
HttpDownloadSettings settings=new HttpDownloadSettings(new URL(sourceID), new HttpDownloadOptions());
|
HttpDownloadSettings settings=new HttpDownloadSettings(new URL(sourceID), new HttpDownloadOptions());
|
||||||
resultingRequest.setSettings(settings);
|
resultingRequest.setSettings(settings);
|
||||||
|
|
|
@ -261,15 +261,17 @@ public abstract class AbstractTicketHandler {
|
||||||
|
|
||||||
|
|
||||||
private static final void setDestinationFileName(TransferTicket ticket){
|
private static final void setDestinationFileName(TransferTicket ticket){
|
||||||
|
|
||||||
switch(ticket.getSettings().getOptions().getMethod()){
|
switch(ticket.getSettings().getOptions().getMethod()){
|
||||||
case HTTPDownload : {
|
case HTTPDownload : {
|
||||||
HttpDownloadSettings options=(HttpDownloadSettings) (ticket.getSettings());
|
HttpDownloadSettings options=(HttpDownloadSettings) (ticket.getSettings());
|
||||||
|
String toSetFilename=retrieveFileName(options.getSource().toString(), ticket.getId());
|
||||||
ticket.getDestinationSettings().setDestinationFileName(retrieveFileName(options.getSource().toString(), ticket.getId()));
|
ticket.getDestinationSettings().setDestinationFileName(toSetFilename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default : ticket.getDestinationSettings().setDestinationFileName(ticket.getId());
|
default : ticket.getDestinationSettings().setDestinationFileName(ticket.getId());
|
||||||
}
|
}
|
||||||
|
log.info("Set filename in ticket {} ",ticket);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public class PersistenceProviderImpl implements PersistenceProvider {
|
||||||
destination.createNewFile();
|
destination.createNewFile();
|
||||||
return destination;
|
return destination;
|
||||||
}catch(IOException e){
|
}catch(IOException e){
|
||||||
throw new DestinationAccessException("Unable to create file ",e);
|
throw new DestinationAccessException("Unable to create file "+destination.getAbsolutePath(),e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue