断点续传学习
就是传说的暂停不重新下载啦
网络学习
这是普通响应
null : [HTTP/1.1 200 OK]
Server : [dae]
Connection : [keep-alive]
X-DAE-App : [andariel]
Date : [Mon, 22 Feb 2016 05:37:11 GMT]
X-Via : [1.1 xixianxiazai55:8107 (Cdn Cache Server V2.0), 1.1 ahhf23:2 (Cdn Cache Server V2.0)]
Cache-Control : [max-age=31536000]
X-DAE-Node : [hador5]
ETag : ["flask-1456114897.0-13518170-3567066477"]
Content-Disposition : [attachment; filename=com.douban.frodo_douban_3.4.2_55.apk]
Expires : [Tue, 21 Feb 2017 05:37:11 GMT]
Content-Length : [13518170]
Age : [1]
Content-Type : [application/vnd.android.package-archive]
设置range头
static void testResp() throws IOException {
String urlnet = "http://img3.douban.com/dae/andariel/static/upload/com.douban.frodo_douban_3.4.2_55.apk";
URL url = new URL(urlnet);
URLConnection conn = url.openConnection();
conn.setRequestProperty("Range", "bytes=0-");
Map<String,?> map = conn.getHeaderFields();
for (String key : map.keySet()) {
System.out.println( key + " : " + map.get(key));
}
}
null : [HTTP/1.1 206 Partial Content]
Server : [dae]
Content-Range : [bytes 0-13518169/13518170]
Connection : [keep-alive]
X-DAE-App : [andariel]
Date : [Mon, 22 Feb 2016 05:37:11 GMT]
X-Via : [1.1 xixianxiazai55:8107 (Cdn Cache Server V2.0), 1.1 ahhf23:2 (Cdn Cache Server V2.0)]
Cache-Control : [max-age=31536000]
X-DAE-Node : [hador5]
ETag : ["flask-1456114897.0-13518170-3567066477"]
Content-Disposition : [attachment; filename=com.douban.frodo_douban_3.4.2_55.apk]
Expires : [Tue, 21 Feb 2017 05:37:11 GMT]
Content-Length : [13518170]
Age : [1]
Content-Type : [application/vnd.android.package-archive]
这里返回206码,支持断点续传,ContentRange写了内容支持多少到多少