当前位置:   article > 正文

Http 416错误_response code: 416

response code: 416
java.io.IOException: Server returned HTTP response code: 416 for URL: http://192.168.18.27:8080/15.jpg
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)

at com.itcast.downloader.download$downloadTH.run(download.java:47)


huc.setRequestProperty("Range", "bytes  =  "+start+"-"+end);

"bytes  =  "+start+"-"+end语句内不能带空格!!


HTTP response code: 416是由于读取文件时设置的Range有误造成的,具体的说就是下面这行代码有误:

httpConnection.setRequestProperty("RANGE", "bytes=1024-");

这个RANGE显然不能超出文件的size


声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/549974
推荐阅读
相关标签
  

闽ICP备14008679号