https://bz.apache.org/bugzilla/show_bug.cgi?id=61217
--- Comment #3 from tzachi.str...@behalf.com --- Guys thank you for the quick response! Chuck, before i opened the bug i saw source code of version 44 and IdentityOutputFilter class have the same logic as 33. i will try to run it with 8.0.44. Mark, it is a good question. but before i answer that i want to share the info that i am running embedded tomcat version 8.0.33 via spring boot. as you can see from below stack trace spring invoke my controller and flush the response right after that. so IdentityOutputFilter initialize at that point. Then the thread return back to my filter that responsible to modify it and write it again. response.getOriginalResponse().getWriter().write(modifyResponseContent); The IdentityOutputFilter instance is already initialized with remaining of the original response. StackTrace: http-nio-9999-exec-5@12102" daemon prio=5 tid=0x19 nid=NA runnable java.lang.Thread.State: RUNNABLE at org.apache.coyote.http11.filters.IdentityOutputFilter.setResponse(IdentityOutputFilter.java:118) at org.apache.coyote.http11.AbstractOutputBuffer.addActiveFilter(AbstractOutputBuffer.java:200) at org.apache.coyote.http11.AbstractHttp11Processor.prepareResponse(AbstractHttp11Processor.java:1492) at org.apache.coyote.http11.AbstractHttp11Processor.action(AbstractHttp11Processor.java:739) at org.apache.coyote.Response.action(Response.java:179) at org.apache.coyote.Response.sendHeaders(Response.java:350) at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:335) at org.apache.catalina.connector.OutputBuffer.flush(OutputBuffer.java:317) at org.apache.catalina.connector.Response.flushBuffer(Response.java:496) at org.apache.catalina.connector.ResponseFacade.flushBuffer(ResponseFacade.java:318) at javax.servlet.ServletResponseWrapper.flushBuffer(ServletResponseWrapper.java:176) at com.zazma.bewebapp.filter.ResponseWrapper.flushBuffer(ResponseWrapper.java:70) at org.springframework.http.server.ServletServerHttpResponse.flush(ServletServerHttpResponse.java:96) at org.springframework.web.servlet.mvc.method.annotation.HttpEntityMethodProcessor.handleReturnValue(HttpEntityMethodProcessor.java:206) at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:81) Questions: 1. In case the controller return JSON (without header Content-Length)it execute ChunkedOutputFilter. 1.1 what is the different between dose output filter? 1.2 why in IdentityOutputFilter ignore the bytes that bigger than remaining // The chunk is longer than the number of bytes remaining // in the body; changing the chunk length to the number // of bytes remaining chunk.setBytes(chunk.getBytes(), chunk.getStart(), (int) remaining); -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org