• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem with Jayson Falkner's (onJava) Compression Filter

 
Ranch Hand
Posts: 281
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had problem using Jayson Falkner's HTTP Compression Filter ("Servlets and JavaServer pages; the J2EE Web Tier", http://www.jspbook.com 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 (http://sourceforge.net/projects/pjl-comp-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 http://sourceforge.net/projects/pjl-comp-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.
 
author
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic