views:

28

answers:

1

I have a question regarding the use of Tomcat 6.0.14, and the interaction between the Tomcat built in compression, and custom filters. I am just using Tomcat - with no http server in front.

My problem is that when I enable my filter, the compression seems to be disabled. This is observed by examining the output from a Fiddler trace.

An example of the headers for the working scenario is:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: no-cache
Set-Cookie: rcounter=17
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Content-Encoding: gzip
Vary: Accept-Encoding
Date: Wed, 29 Sep 2010 04:47:50 GMT

A non working scenario is:

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Cache-Control: no-cache
Set-Cookie: rcounter=3
Pragma: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
Date: Wed, 29 Sep 2010 04:44:49 GMT

The compression is defined using the server.xml configuration file:

<Connector port="8202" protocol="HTTP/1.1"
    maxThreads="120" minSpareThreads="4"/>
           connectionTimeout="20000"
           compression="on"
           compressionMinSize="2048"
           compressableMimeType="text/html,text/plain,text/css,text/javascript"
           redirectPort="8402" />

The filter is defined in the web.xml for the server (not the webapp).

I was wondering if anyone had experience with this, or suggestions on what to check.

cheers, Evan

A: 

Is it a typo in your tag?

You're already closing the <Connector> here

maxThreads="120" minSpareThreads="4"/>

and the rest are ignored?

JoseK
yes, of course you're correct.
Evan
Apologies for posting such a simple question - but I was at my wits end looking for what could be wrong.To make matters worse, it was highlighted in the code I posted by the color highlighting.Thanks for your assistance.
Evan
ps. also, I'm a little puzzled how Tomcat started with an invalid server.xml file ... something I'll follow up.
Evan
@Evan: you're right - the highlighted code was what made me spot it too and an extra pair of eyes is what SO is for :)
JoseK