-
Notifications
You must be signed in to change notification settings - Fork 37.8k
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
InputStream consumed by DispatcherServlet logRequest #24176
Comments
Or maybe its completely related it seems to be a |
Yes this is expected, and besides the logging of request details, any other code could cause a similar issue by accessing a request parameter. Note that you can inject the content reliably as |
Great, I will do some tests with the |
A major drawback is that even the |
The |
So may I interpret this thread as follows?: Receiving stream via HTTP request body is not what Spring is designed to support..? Because by any reason, reading stream can happen before the request body reaches to controller. |
This issue concerns the use of one of the |
This does cause the CommonsMultipartResolver to no longer work (if logging on DispatcherServlet is enabled), resulting in an error Should we no longer use CommonsMultipartResolver? |
Yes, just use the standard multipart support in the Servlet container. |
Affects: 5.2.1
A few weeks ago I enabled debug logging for my application, today I had forgotten about but noticed that my injected
InputStream
was empty. After a debugging session (first assuming it again was related to theHiddenHttpMethodFilter
) I ended up atspring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java
Lines 955 to 965 in 8d84650
So every time I enable debug logging I cannot use my injected
InputStream
:I do now get this logging:
But maybe it would make sense to auto-wrap the request in DEBUG when that logging is active or give a warning when injecting the consumed
InputStream
later and even report who did it 😄Thanks!
Related to (but not covered by): #22985
The text was updated successfully, but these errors were encountered: