Women in Technology

Hear us Roar



Article:
  Two Servlet Filters Every Web Application Should Have
Subject:   Dealing with "This output stream has already been closed" Errors
Date:   2004-01-25 20:49:33
From:   jfalkner
Several people have informed me that sometimes the GZIP filter throws an IOException with the above message. This occurs if the container/framework/your-code or whatever tries to close the output stream more than once -- which shouldn't happen. However, allowing for the filter's close() method to be called multiple times doesn't hurt the code.


I've changed the default implementation to not complain if the close() method is called multiple times. This seems to make the Struts framework, JBoss, and WebSphere happier while not hurting Tomcat. Please grab the latest code if you are having this problem, and please let me know how the change works for you.


Cheers,
Jayson Falkner
jayson@jspinsider.com
http://www.jspbook.com