Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize byte range requests to S3 Storage #771

Merged
merged 1 commit into from
Feb 11, 2022

Conversation

paulcwarren
Copy link
Owner

@paulcwarren paulcwarren commented Feb 10, 2022

Only download the requested byte range and not the entire content.

private void configureResourceForByteRangeRequest(RangeableResource resource, HttpHeaders headers) {
List<String> byteRanges = headers.get("Range");
if (byteRanges == null) {
byteRanges = headers.get("range");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HttpHeaders is a case-insensitive map, so there is no need to check both capitalized and lowercase variants.

There is also the HttpHeaders#getFirst(String) method that can replace even more.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Updated.

@paulcwarren paulcwarren changed the title Spring Content REST now configures resources with the byte range (where requested) Optimize byte range requests to S3 Storage Feb 11, 2022
- only download the request range and not the entire content
@paulcwarren paulcwarren force-pushed the feature/byte-range-optimization branch from 25de0fc to b2b7208 Compare February 11, 2022 05:36
@paulcwarren paulcwarren merged commit 1aecd18 into main Feb 11, 2022
@paulcwarren paulcwarren deleted the feature/byte-range-optimization branch February 11, 2022 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants