Avoid writing content-length twice in resource handling
Prior to this commit, the `ResourceHttpRequestHandler` would write the resource size to the "Content-Length" response header. This is already done by the underlying `ResourceHttpMessageConverter` and `ResourceRegionHttpMessageConverter`. This commit avoid this duplicate operation and delegates instead to the converters. See gh-26330 Closes gh-26340
This commit is contained in:
parent
5804db6479
commit
efa360cff7
|
|
@ -759,14 +759,6 @@ public class ResourceHttpRequestHandler extends WebContentGenerator
|
|||
protected void setHeaders(HttpServletResponse response, Resource resource, @Nullable MediaType mediaType)
|
||||
throws IOException {
|
||||
|
||||
long length = resource.contentLength();
|
||||
if (length > Integer.MAX_VALUE) {
|
||||
response.setContentLengthLong(length);
|
||||
}
|
||||
else {
|
||||
response.setContentLength((int) length);
|
||||
}
|
||||
|
||||
if (mediaType != null) {
|
||||
response.setContentType(mediaType.toString());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue