I came across a portion of code that zips the servlet output before returning it to the user, it uses a custom ServletResponseWrapper
-it's so famous if u know what I am talking about-, my questions are :
1 - now the function of intercepting the response is totally the responsibility of the response wrapper -through overriding the output stream it returns- and the filter has no effect in such behaviour ? Am I correct ?
2- what happens if any of the servlets that the filters intercept its requests closed the output stream, will the code after chain.doFilter() be able to use this stream again ? and will the filter work ?
3 why does the wrapped response solve the problem of the "output returns directly to the container before being intercepted by the filter" ... I mean why the control over the response is then returned to the filter ?