Skip to content

Regression: ShallowEtagHeaderFilter does not add Etag header for ResponseEntity returning methods [SPR-13717] #18290

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jan Gaedicke opened SPR-13717 and commented

As we updated our spring dependencies from 4.0.8.RELEASE to 4.2.3.RELEASE the ShallowEtagHeaderFilter stopped working for spring controller methods that return a ResponseEntity. The effect is that no "Etag" header is added to the response.

The problem is, that the HttpEntityMethodProcessor flushes the HttpServletResponse and the ShallowEtagHeaderFilter refuses to add the header if the response is committed.

As a workaround we have implemented the flushBuffer method in the ContentCachingResponseWrapper and delay the original flushBuffer call until copyBodyToResponse is called.

You can find a small spring-boot app using a tomcat to reproduce this bug at github:
https://github.com/jgaedicke/ShallowEtagHeaderFilter-bug-demo.


Affects: 4.2.2, 4.2.3

Reference URL: https://github.com/jgaedicke/ShallowEtagHeaderFilter-bug-demo

Issue Links:

Referenced from: commits 9d9433a

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