Skip to content

StringHttpMessageConverter flush out response immediately before execute posthandler [SPR-16046] #20595

@spring-projects-issues

Description

@spring-projects-issues

eric wang opened SPR-16046 and commented

the problem is related @RequestBody the ajax request, if the response content-type is text/plain that means the handler method return string directly, the StringHttpMessageConverter will getting used to handler the HTTP message convert. the problem seems in the writeInternal method, it is calling StreamUtils.copy(String in, Charset charset, OutputStream out) which will create a new Write and flush the response content out immediately.

this problem caused all subsequence handlers like posthandler got executed after response return to the client.

the repro steps should be easy, just create a controller with @ResponseBody and return string directly.


Affects: 4.3.11

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions