Oleksiy Stashok wrote:
> Pls. take a look here at Jeanfrancois'es blog [1]. Seems by default
> compression is set to "off", so it needed to be switched "on".
> [1]
> http://weblogs.java.net/blog/jfarcand/archive/2006/06/enabling_http_c_1.html
Great thank you. You are right, it is set to off out of the box. I
added this, and GZip'ing did indeed burst into life.
st.setCompression("on");
st.setCompressionMinSize( 14000 );
Although, i can't seem to get a handle to how much data was sent to the
client when gziping. I thought this maybe may tell me, but it prints 0
and -1 respectfully.
public void afterService(Request arg0, Response res) throws Exception {
System.out.println(
"afterService: getBytesWritten=" + res.getBytesWritten() +
"; getContentLength=" + res.getContentLength() );
}
I want to log how much data we are saving by GZIP'ing and the percentage
of clients that actually received GZIP content. Very useful data this.
Any advice gratefully received. I am loving this Grizzly so far, and
while the documentation in the JavaDocs is thin on the ground, i am
discovering that Jeanfrancois blog is the place to be!
thanks
a