Hello everyone,
I just want to introduce a new fluent method to PackageResource /
PackageResourceReference which is called readPartially(boolean). It
adresses a memory consumption issue while reading media files (audio,
video) or other large resource files.
Before this implementation the content of each file shipped with a
PackageResourceReference were copied into memory and then the part the
client requested (Content-Range, Range, Accept-Range) was transfered to
the client.
Now only the part the client requested is read and transfered directly
to the response, without storing it into memory (ByteArrayInputStream,
byte[]) - For normal the PackageResourceReference is reading it from disk.
If the method isn't invoked or invoked with false the old behavior is used.
The only limitation is that no
org.apache.wicket.resource.ITextResourceCompressor will be used if the
flag is set to true, because the content will not be analyzed.
I decided to first put it into a branch and discuss it here:
Branch: https://github.com/apache/wicket/compare/WICKET-5819_Improvements
Ticket: https://issues.apache.org/jira/browse/WICKET-5819
What do you think?
kind regards
Tobias