Please watch this short video which shows my problem in detail: http://youtu.be/uAza4m3fxpY?hd=1
I have a Glassfish 3.1 server running a Netbeans Web Project.
I have a very simple .jsp file with content type set to ‘text/html’ and a large paragraph of dummy text in the body. It looks like this:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Gzip Test</title>
</head>
<body>
<h1>Gzip compsression test</h1>
<p>****LOTS OF DUMMY TEXT***</p>
</body>
</html>
In Glassfish admin, I have forced-enabled gzip compression for the HTTP listener (as described in this guide: http://www.vikasing.com/2010/01/enable-gzip-compression-on-glassfish-v3.html)
When load the page in Firefox and look at the response header, I would expect to see Content-Encoding: gzip, but it’s not there.
Why is the content not being Gzipped?
I’ve discovered that this is a bug in Glassfish 3.1. It does not property split the
accept-encodingheader using the,character. For example, if you set firefox’saccept-encodingheader to:gzip, deflateit will not gzip the content because the comma screws it up, but if you set it togzipthen it does get gzipped by the server because there is no comma to choke on. Apparently this has been fixed in Glassfish 3.1.1 but I have not tested it yet. See: http://www.java.net/forum/topic/glassfish/glassfish/gzip-compression-glassfish-3-doesnt-work?force=899 for more details.