Browse Source
Prior to this commit, flush calls on the output stream returned by `ServletServerHttpResponse#getBody` would be delegated to the Servlet response output stream. This can cause performance issues when `HttpMessageConverter` and other web components write and flush multiple times to the response body. Here, the Servlet container is in a better position to flush to the network at the optimal time and buffer the response body until then. This is particularly true for `HttpMessageConverters` when they flush many times the output stream, sometimes due to the underlying codec library. Instead of revisiting the entire message converter contract, we are here ignoring flush calls to that output stream. This change does not affect the client side, nor the `ServletServerHttpResponse#flush` calls. This commit also introduces a new Spring property `"spring.http.response.flush.enabled"` that reverts this behavior change if necessary. Closes gh-36385pull/28225/merge
5 changed files with 74 additions and 9 deletions
Loading…
Reference in new issue