Hi all,

  The compression filter in tomcat 4b7 seems to work fine when
using it against a simple servlet output, but I had some
difficulties to make it work with static files (served by the
DefaultServlet) and Jsps.

  In order to reproduce the problem, simply add the following
filter mapping to the examples webapp :

    <filter-mapping>
      <filter-name>Compression Filter</filter-name>
      <url-pattern>*.html</url-pattern>
    </filter-mapping>

  When getting /examples/jsp/index.html, only 10 bytes are
actually sent. The problem comes from the fact that a GZIPOutputStream
must be explicitly closed, a call to flush is not enough.

  I solved this one by adding a call to close in
DefaultServlet.copy(ResourceInfo resourceInfo,
                    ServletOutputStream ostream) :

        // Clean up the output stream
        try {
            ostream.close();
        } catch (Throwable t) {
            ;
        }

Strangely enough, the method comment says :
"and ensure that both streams are closed" 
but this is not implemented that way, is there a reason I have
missed ?

There seems to be the same problem with Jasper, but I didn't have
time to patch it.
  
-- 
Mickael Guessant
Consultant
Fi System France - http://www.fisystem.com
mailto:[EMAIL PROTECTED]
Tel: +33 141 026 062

Reply via email to