Currently the option for compression="on" in the coyote connector is broken
(see bug 18073).  The solution presented in the patches attached to that bug
seemed overly complicated.  Here is an alternate patch that also fixes the
problem.

This patch changes 3 things:
1) Decreases the minimum compression size to 1k - this seemed to help with
my particular application.  There was a lot in the range of 1-2k.
2) Checks only that the content type starts with an entry in the
compressableMimeTypes list instead of checking equality.  This is the real
bug fix since the contentType also includes the character encoding
information.
3) Added application/x-javascript as a default compressable type.  Now it
allows all mime types starting with "text/", not just the three previously
specified.


Index: Http11Processor.java
===================================================================
RCS file:
/home/cvspublic/jakarta-tomcat-connectors/http11/src/java/org/apache/coyote/
http11/Http11Processor.java,v
retrieving revision 1.78
diff -r1.78 Http11Processor.java
273c273
<     protected int compressionMinSize = 2048;
---
>     protected int compressionMinSize = 1024;
291c291
<     protected String[] compressableMimeTypes = { "text/html", "text/xml",
"text/plain" };
---
>     protected String[] compressableMimeTypes = { "text/",
"application/x-javascript" };
462a463,478
>        /**
>      * General use method
>      *
>      * @param sArray the StringArray
>      * @param value string
>      */
>     private boolean startsWithStringArray(String sArray[], String value) {
>         if (value == null)
>            return false;
>         for (int i = 0; i < sArray.length; i++) {
>             if (value.startsWith(sArray[i])) {
>                 return true;
>             }
>         }
>         return false;
>     }
1216,1217c1232,1233
<             if (compressableMimeTypes != null)
<                 return (inStringArray(compressableMimeTypes,
response.getContentType()));
---
>             if (compressableMimeTypes != null)
>                return (startsWithStringArray(compressableMimeTypes,
response.getContentType()));


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to