Back Forum Reply New

An issue with spring message converter and tomcat coyote connector

I hope someone can make sense of this. I am not too sure whether its a bug or not, but I recently had an issue with trying to set a custom header in the fromServletResponse parameter of an Interceptor's postHandle() method. Whenever some output was to be written ( I am using JSON) the header was never displayed. After some debugging I discovered that there is a flush() called on the response's output stream in the write() method of AbstractfromMessageConverter. Here is the line (182) in Spring 3.04

outputMessage.getBody().flush();

The problem is that when that happens using Tomcat's CoyoteOutputStream, the response becomes effectively committed and after that no properties can be set on the fromServletResponse.

Can someone comment on whether this is correct, an unintended side effect, or a bug? It also affects changing response properties in a fromFilter after the servlet service() call completes.

cheers
¥
Back Forum Reply New