Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java URLConnection setRequestProperty";“范围”;标题获取HTTP 416?旋度工作_Java_Android - Fatal编程技术网

Java URLConnection setRequestProperty";“范围”;标题获取HTTP 416?旋度工作

Java URLConnection setRequestProperty";“范围”;标题获取HTTP 416?旋度工作,java,android,Java,Android,我需要使用“Range”标题继续用我的android应用程序下载部分下载的文件 conn.setRequestProperty("Range", "bytes=" + this.downloadedBytes + "-"); 当我把它记录到logcat上时,我只看到我拥有的东西 conn.getRequestProperties().toString() {Range=[bytes=3129-]} 我的服务器使用HTTP 416进行响应,无法满足范围要求。我在apache访问日志中看到了这个

我需要使用“Range”标题继续用我的android应用程序下载部分下载的文件

conn.setRequestProperty("Range", "bytes=" + this.downloadedBytes + "-");
当我把它记录到logcat上时,我只看到我拥有的东西

conn.getRequestProperties().toString()
{Range=[bytes=3129-]}
我的服务器使用HTTP 416进行响应,无法满足范围要求。我在apache访问日志中看到了这个响应。我得到了一个IOException(java.io.FileNotFoundException),这是我猜测它如何处理416,就像处理404一样。这是一个完全正常的响应,除了curl对同一个文件非常有效

curl -I --header "Range: bytes=3129-` ...
我得到了预期的HTTP 200响应:

Last-Modified: Fri, 27 Mar 2015 15:26:59 GMT
Accept-Ranges: bytes
Content-Length: 1915
Cache-Control: max-age=0
Expires: Fri, 27 Mar 2015 19:17:33 GMT
Vary: Accept-Encoding
Content-Range: bytes 3129-5043/5044
Content-Type: text/html
我在android/java方面遗漏了什么?当curl工作正常时,让apache返回416的请求又如何呢