-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Description
Carlus Henry opened SPR-10236 and commented
We have the need to accept an HttpRequest with the content-type of multipart/form-data. We then have to turn around and respond with the same content-type of multipart/form-data. We are using the FormHttpMessageConverter in order to accomplish this.
However, during testing, we noticed that we were only receiving one form-data parameter part. After debugging the code, we realized that this was due to the fact that the StringHttpMessageConverter is used to convert the String type elements. After writing the first string to the output, it closes the outputstream. Then when it tries to write the next form-data part, it throws an exception since the output stream has already been closed.
Here are the order of operations:
FormHttpMessageConverter(FHMC)
StringHttpMessageConverter(SHMC)
FHMC.writePart() -> SHMC.write() -> SHMC.writeInternal() -> FileUtils.copy()...The FileUtilsCopy will close the outputstream.
Affects: 3.2.1
Issue Links:
- Ensure HttpMessageConverter classes don't close the response stream [SPR-10095] #14728 Ensure HttpMessageConverter classes don't close the response stream ("duplicates")