Hi Craig,
See comments below....
At 05:44 PM 1/13/2003 -0800, you wrote:
On Mon, 13 Jan 2003, Jacob Kjome wrote:
> Date: Mon, 13 Jan 2003 16:59:44 -0600
> From: Jacob Kjome <[EMAIL PROTECTED]>
> Reply-To: Tomcat Users List <[EMAIL PROTECTED]>,
> Jacob Kjome <[EMAIL PROTECTED]>
> To: Tomcat Users List <[EMAIL PROTECTED]>
> Subject: issue setting headers in a filter....
>
>
> I brought this issue up previously in a question about a GZIP servlet filter
> which I had based on an example that was supposed to have worked on
> the Orion server. I still have gotten nowhere. The curious thing is
> that it works fine when serving a static html file, but fails when
> serving jsp's or servlets.
>
I didn't exhaustively study your filter (it's got an "if" statement that
determines whether compression will take place -- have you ensured that
all these conditions are satisfied?).
Yep, I've got log4j debugging going on and I guarantee that the JSP is running through the GZIP routine. In fact, I'd know it anyway because it shows up at the browser as a garbled mess of non-decompressed GZIP data.
However, one notable difference is
that there's a content length set on the static file (by the default
file-serving servlet), but not from the JSP page. I wouldn't be surprised
if that turned out to be significant.
Well, it might be, but I'm pretty sure it isn't the issue. The GZIP filter in Tomcat doesn't set the content-length header and it works just fine. Anyhow, when I run another servlet through the GZIP filter, the content-length header gets set, but only because my original servlet set it. The real issue is, the same code that attempts, and fails, to set/reset the "Vary", "Content-Encoding", and "Content-Length" headers for servlets and JSP's, succeeds for the static HTML.
So, the question is, why when the setting of the headers is, for sure, happening for both static files and servlets, does the resulting response end up with the GZIPFilter-set values *only* in the case of the static HTML?
Since it looks like you got this filter from Orion's tutorial, you might
want to ask about it there as well. Or, you could look at the one
included with Tomcat (in the examples webapp) for ideas.
I will ask on Orions site. However, I have looked at tomcat's GZIP filter and can't figure out why it works and this doesn't? The thing is, this example follows the same pattern as a pretty much all the other GZIP filters I've seen out there including...
http://archive.moreservlets.com/Filter-Code/filters/WEB-INF/classes/moreservlets/filters/CompressionFilter.java
http://www.orionserver.com/tutorials/filters/5.html
and one more that I can't find again.
Anyway, both those take similar strategies and neither work under Tomcat for servlets. because the response headers are never successfully set in the filter when it is filtering the output of a servlet or JSP. Again, it only works with static HTML. This is why I'm somewhat leaning toward the conclusion that this is a bug in tomcat.
I'm including a zip file with all required classes and a readme with filter/filter-mapping info for others to test out. Craig, I would really appreciate it if you could take a look because I just can't see why this shouldn't work?
Thanks,
Jake
Craig
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
GZIPFilter.zip
Description: Zip archive
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
