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

Should call getNativeResponse() instead of getNativeRequest() in FrameworkServlet [SPR-15867] #20422

Closed
spring-issuemaster opened this Issue Aug 16, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Aug 16, 2017

Etienne Neveu opened SPR-15867 and commented

While reading the code of FrameworkServlet#RequestBindingInterceptor, I noticed that we try to obtain the HttpServletResponse using webRequest.getNativeRequest(HttpServletResponse.class) instead of webRequest.getNativeResponse(HttpServletResponse.class) :

https://github.com/spring-projects/spring-framework/blob/v5.0.0.RC3/spring-webmvc/src/main/java/org/springframework/web/servlet/FrameworkServlet.java#L1142

I'm wondering if it's a typo, and if it should be fixed?

I'm not sure about the impact, but it seems to have been added in this commit, so I guess it is not a huge issue, since the code is here since 2013... But I thought I might as well create a ticket, just in case.


Affects: 4.3.10, 5.0 RC3

Issue Links:

  • #14976 Change in FrameworkServlet makes it impossible to use an alternative WebRequest instance for request processing

Referenced from: commits 9dcdfec, b8f5e97

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Aug 16, 2017

Juergen Hoeller commented

Good catch! Indeed, that's accidental. We do not rely on the HttpServletResponse being present in the RequestAttributes for standard purposes, which is why we haven't noticed this... but the whole point of course is to make it available for custom use even in async request callbacks, so this needs to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.