File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Problem with Jayson Falkner's (onJava) Compression Filter Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Problem with Jayson Falkner Watch "Problem with Jayson Falkner New topic

Problem with Jayson Falkner's (onJava) Compression Filter

Sam Gehouse
Ranch Hand

Joined: Jul 21, 2003
Posts: 281
I had problem using Jayson Falkner's HTTP Compression Filter ("Servlets and JavaServer pages; the J2EE Web Tier", by Jayson Falkner), as it returned warning as response is already committed when app server does a server-side forward and tries to apply the filter a second time. I was using WSAD5.1.1 and Struts 1.1. However, the behaviors is the same outside of Struts environment (meaning, while not using Struts) under WSAD 5.1.1.

I got it solved by using Sean Owne's Compression Filter ( with /* as url-pattern.

Comments from Sean Owen:

Re: Problem with *.do in Filters using Struts
Topic: Struts
Sean Owen, Nov 8, 2004 [replies:2]
"/*" is right. I think you are running into a bug in GZipFilter. I don't believe it works when the app server does a server-side forward and tries to apply the filter a second time. The recompression totally messes up the response. If I may plug my own work... I created an open-source compression filter that does not have this bug. It's also cleaner, faster and more full-featured than this old GZipFilter that people seem to use. Give it a try, along with a setting of "/*", and see if that solves your problem. PJL Compressing Filter

Additional comments from me:
I am now using Sean Owen's Filter, instead of Jayson Falkner's filter. My filter mapping is:

<filter-mapping> <filter-name>CompressingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>

It works fine without throwing any Exception within Struts framework.

However, if I use /*.do, or /*.jsp, or /*.htm, it does not invoke the filter. It invokes the filter (obviously, for every page) only with /* url-pattern.

Question to Sean: Do you know why?

My Servlet does redirection to another JSP and Sean's filter is working fine within my Struts environment.

Comment to Sean: You have many assert statements like: assert config != null; You might consider removing those lines from published code. Otherwise, users have to comment those lines for the code to compile.
Sean Owen

Joined: Nov 08, 2004
Posts: 21
My reply from JGuru...

Thanks, glad it is working for you. I think you want to use the pattern "*.do" instead of "/*.do". Regarding assertions -- yes you'll need JDK 1.4 to compile the code since I'm using assertions. Let me know if it won't build in 1.4 for some reason. Or, try using the pre-compiled .jar file in the distribution. But I imagine you are trying to compile this so it runs on JDK 1.3, or earlier? I will try to modify the build so that you get a 1.3-compatible option without having to modify code. Do you need support for earlier JVMs like 1.2?
Have you tried LearnNowOnline?
subject: Problem with Jayson Falkner's (onJava) Compression Filter