StringHttpMessageConverter closes output stream causes problem with FormHttpMessageConverter [SPR-10236] #14869
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
status: duplicate
A duplicate of another issue
Milestone
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:
The text was updated successfully, but these errors were encountered: