关键词:springboot,download,Range,Content-Range,Content-Length,http code 206 Partial Content 下载文件的一部分,我们在request header:Range 中指定要获取的文件的字节范围。要注意http response header:Content-Length 一定要与Range中所表示的获取bytes的范围长度相等。 如果Content-Length大于要Range所表示的bytes长度,那么客户端在发起请求后,下载完相应的Range范围的bytes后,连接不会自动关闭,直到连接超时,抛出异常。 如果Content-Length小于要Range所表示的bytes长度,那么发起请求后,只会获得Content-Length所指定的较小范围的bytes,导致获取的数据不完整。 controller: @SneakyThrows @GetMapping("/download") public void download(HttpServletResponse response,...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with String
Contact String, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack