Skip to content

Update advice on contentLength() in subclasses of InputStreamResource  #20990

Closed
@spring-projects-issues

Description

@spring-projects-issues

bademus opened SPR-16445 and commented

It seems the bug was introduced in #16633
org.springframework.http.converter.ResourceHttpMessageConverter#getContentLength

// Don't try to determine contentLength on InputStreamResource - cannot be read afterwards...
// Note: custom InputStreamResource subclasses could provide a pre-calculated content length!
if (InputStreamResource.class == resource.getClass()) {
     return null;
}

In fact default behavior of InputStreamResource is not the same as for its children.


Affects: 4.3.14

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: taskA general task

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions