Fabio Sinibaldi 2017-12-18 15:25:26 +00:00
parent 3194959b9e
commit 34e9e8c34f
3 changed files with 6 additions and 4 deletions

View File

@ -144,7 +144,7 @@ public class REST {
}
case HTTPDownload :{
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{
HttpDownloadSettings settings=new HttpDownloadSettings(new URL(sourceID), new HttpDownloadOptions());
resultingRequest.setSettings(settings);

View File

@ -261,15 +261,17 @@ public abstract class AbstractTicketHandler {
private static final void setDestinationFileName(TransferTicket ticket){
switch(ticket.getSettings().getOptions().getMethod()){
case HTTPDownload : {
HttpDownloadSettings options=(HttpDownloadSettings) (ticket.getSettings());
ticket.getDestinationSettings().setDestinationFileName(retrieveFileName(options.getSource().toString(), ticket.getId()));
String toSetFilename=retrieveFileName(options.getSource().toString(), ticket.getId());
ticket.getDestinationSettings().setDestinationFileName(toSetFilename);
break;
}
default : ticket.getDestinationSettings().setDestinationFileName(ticket.getId());
}
log.info("Set filename in ticket {} ",ticket);
}

View File

@ -135,7 +135,7 @@ public class PersistenceProviderImpl implements PersistenceProvider {
destination.createNewFile();
return destination;
}catch(IOException e){
throw new DestinationAccessException("Unable to create file ",e);
throw new DestinationAccessException("Unable to create file "+destination.getAbsolutePath(),e);
}
}
}