调整断点续传
This commit is contained in:
parent
7db0f91c87
commit
d31e3d93dc
@ -252,7 +252,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
|||||||
*/
|
*/
|
||||||
private void setRangeHeader(long startRange, long endRange, HttpServletResponse response, String fileId, long contentLength) {
|
private void setRangeHeader(long startRange, long endRange, HttpServletResponse response, String fileId, long contentLength) {
|
||||||
// 这里不设置,会出现第一次加载很慢的情况
|
// 这里不设置,会出现第一次加载很慢的情况
|
||||||
response.setHeader("Content-Length", String.valueOf(contentLength - startRange));
|
response.setHeader("Content-Length", String.valueOf(endRange - startRange + 1));
|
||||||
response.setHeader("Content-Range", String.format("bytes %d-%d/%d", startRange, endRange, contentLength));
|
response.setHeader("Content-Range", String.format("bytes %d-%d/%d", startRange, endRange, contentLength));
|
||||||
response.setHeader("Accept-Ranges", "bytes");
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
response.setHeader("Etag", fileId);
|
response.setHeader("Etag", fileId);
|
||||||
|
Loading…
Reference in New Issue
Block a user