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

StringHttpMessageConverter closes output stream causes problem with FormHttpMessageConverter [SPR-10236] #14869

Closed
spring-projects-issues opened this issue Jan 29, 2013 · 2 comments
Assignees
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jan 29, 2013

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:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Feb 7, 2013

Rossen Stoyanchev commented

This looks like a duplicate of #14728.

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Feb 8, 2013

Carlus Henry commented

After reviewing #14728, I agree. This is a duplicate....thanks
Carlus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web Issues in web modules (web, webmvc, webflux, websocket) status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

2 participants