Here is how I compressed the data:
<%@ page import="javax.servlet.jsp.*,java.io.*,java.util.zip.*" %>
<%
String encodings = request.getHeader("Accept-Encoding");
PrintWriter outWriter = null;
if ((encodings != null) && (encodings.indexOf("gzip") != -1)) {
OutputStream outA = response.getOutputStream();
outWriter = new PrintWriter(new GZIPOutputStream(outA), false);
response.setHeader("Content-Encoding", "gzip");
int a = response.getBufferSize();
System.out.println("ZIPPED VERSION BF:"+a);
}
else {
System.out.println("UN-ZIPPED VERSION");
outWriter = new PrintWriter(response.getOutputStream(), false);
}
outWriter.println("<HTML><BODY>");
for(int i=0; i<1000; i++) {
outWriter.println(" blah blah blah<br>");
}
outWriter.println("</BODY></HTML>");
outWriter.close();
%>