Skip to content

AbstractMessageConverterMethodProcessor doesn't respect already handled headers and result-codes [SPR-16921] #21460

Closed
@spring-projects-issues

Description

@spring-projects-issues

Alexander Schuetz opened SPR-16921 and commented

We support ranged requests at specific entrypoints in our REST-API (especially for embedding videos and other large documents).

Since we don't work on files and the data is potentially large we cannot use File-resources and don't want to use byte[]. Instead we are using InputStreamResource which only contains the requested range of data as stream.

The controller method sets the status code 206 and also sets the following headers:

  • ETag
  • Content-Disposition
  • Accept-Ranges
  • Content-Range

In version 4.3.17.RELEASE everything works fine and i.e. videos are displayed correctly in browsers Chrome, Firefox and InternetExporer.

Upgrading to version 5.0.2 breaks this functionality, since AbstractMessageConverterMethodProcessor tries to handle the ranged-request itself and doesn't recognize that it has already been handled. Thus it calls InputStreamResource.getContentLength() and tries to read the InputStream afterwards which results in an Exception, since the stream can only be read once. => status code 500 is returned.

 

We needed to return to spring version 4 because of this behaviour.


Affects: 5.0.2

Issue Links:

Referenced from: commits 818e4b0

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions