This commit is contained in:
AriaLyy
2017-12-26 21:29:19 +08:00
10 changed files with 42 additions and 9 deletions

View File

@@ -62,6 +62,18 @@ public class DownloadTarget
mTaskEntity.refreshInfo = refreshInfo;
}
/**
* 是否使用服务器通过content-disposition传递的文件名内容格式{@code attachment;filename=***}
* 如果获取不到服务器文件名,则使用用户设置的文件名
* 只适用于HTTP请求
*
* @param use {@code true} 使用
*/
@Deprecated public DownloadTarget useServerFileName(boolean use) {
mTaskEntity.useServerFileName = use;
return this;
}
/**
* 将任务设置为最高优先级任务,最高优先级任务有以下特点:
* 1、在下载队列中有且只有一个最高优先级任务

View File

@@ -54,6 +54,7 @@ class HttpFileInfoThread implements Runnable {
conn = ConnectionHelp.setConnectParam(mTaskEntity, conn);
conn.setRequestProperty("Range", "bytes=" + 0 + "-");
conn.setConnectTimeout(mConnectTimeOut);
conn.setRequestMethod(mTaskEntity.requestEnum.name);
conn.connect();
handleConnect(conn);
} catch (IOException e) {

View File

@@ -168,7 +168,8 @@ public abstract class AbsTarget<TARGET extends AbsTarget, ENTITY extends AbsEnti
}
/**
* 设置请求类型
* 设置请求类型POST或GET默认为在GET
* 只试用于HTTP请求
*
* @param requestEnum {@link RequestEnum}
*/

View File

@@ -105,6 +105,12 @@ public abstract class AbsTaskEntity<ENTITY extends AbsEntity> extends DbEntity {
*/
public String md5Key = "Content-MD5";
/**
* 是否使用服务器通过content-disposition传递的文件名内容格式{@code attachment;filename=***}
* {@code true} 使用
*/
public boolean useServerFileName = false;
/**
* 从header中获取文件描述信息所需要的key
*/