contentLength support for Resource decoding

Expose the known content length, if known, in the InputStreamResource returned by ResourceHttpMessageConverter or
ResourceDecoder.

See gh-24292
This commit is contained in:
Oleh Faizulin
2020-01-04 09:54:53 +02:00
committed by Rossen Stoyanchev
parent e3e7d90415
commit e96b71acf3
4 changed files with 30 additions and 0 deletions

View File

@@ -84,6 +84,11 @@ public class ResourceHttpMessageConverter extends AbstractHttpMessageConverter<R
public String getFilename() {
return inputMessage.getHeaders().getContentDisposition().getFilename();
}
@Override
public long contentLength() {
return inputMessage.getHeaders().getContentLength();
}
};
}
else if (Resource.class == clazz || ByteArrayResource.class.isAssignableFrom(clazz)) {