Skip to content

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

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

Closed
spring-projects-issues opened this issue Nov 23, 2015 · 6 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Nov 23, 2015

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

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Nov 23, 2015

Juergen Hoeller commented

Looking at the version history, I assume this does not happen with 4.1.8, i.e. it's a regression in the 4.2 line?

Brian Clozel, this seems to be a side effect of your changes around #13194...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

I fixed this issue by not delegating the flushBuffer call to the actual response.
Indeed, multiple parts of Spring can commit the response, making it impossible for the filter to act on it.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Jan Gaedicke, could you please give a recent 4.2.4.BUILD-SNAPSHOT a try and let us know whether it works for you now?

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Jan Gaedicke commented

Great, thanks for the quick fix. It works for me. Any ideas when the next release will be available?

@spring-projects-issues
Copy link
Collaborator Author

Brian Clozel commented

Thanks for the feedback!
For now it's scheduled on December 22nd; you can follow its status here: https://jira.spring.io/browse/SPR/fixforversion/15353/

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

In this particular case, Dec 22 has to be seen "on Dec 22 at the latest". We might pull it forward by a week or so. In any case, we'll keep the release target on JIRA up to date.

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants