Help coderanch get a
new server
by contributing to the fundraiser

El Laped

Greenhorn
+ Follow
since May 18, 2014
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by El Laped

Good book. I am at the end of it. I have got into the the same problem.
It bugged me so I have looked deeper.

In order to see the output of the jsp, you need to flush the output buffer somewhere along the chain.
For testing, you can just put a scriptlet at the end of the jsp "out.flush();" You will see the jsp in full in the browser.

In the CompressionFilter, after the call the the filterchain "doFilter" method, you need to flush the response. Something like "wrappedResp.getWriter().flush();"

Tomcat has a more complete implementation of the compression filter. Looking at the source code of tomcat you can see that
- in the filter they call custom finishResponse method on the custom response ->
- which in turn call close on the custom stream ->
- which was overrided to perform a flush before doing close on stream.



Additional interesting resources:
- http://stackoverflow.com/questions/1159168/should-one-call-close-on-httpservletresponse-getoutputstream-getwriter
- http://www.oracle.com/technetwork/java/filters-137243.html#72674