spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Stream Closed appears when uploading files using MultipartFile

Open Mr-YW opened this issue 3 years ago • 0 comments

In order to read the body twice, we rewrite the HttpServletRequestWrapper,And wrap the original request through the Filter.Although we packing the original Request, upload files, StandardMultipartHttpServletRequest call or use the original Request, not after we packing, We rewrite HttpServletRequestWrapper getInputStream method is not called, the original flow has been closed, result in an error

At present, our solution is to call the getParameter method of request once in the wrapped Filter to solve this problem

StreamClosed.zip

Mr-YW avatar Aug 05 '22 09:08 Mr-YW