为HttpServletResponse返回gziping PrintWriter
/* 来 自 时代Java - nowjava.com*/ import java.io.IOException; import java.io.PrintWriter; import java.util.zip.GZIPOutputStream; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class Main{ /** Return gzipping PrintWriter for response */ public static PrintWriter getGzipWriter(HttpServletResponse response) throws IOException { return (new PrintWriter(new GZIPOutputStream( response.getOutputStream()))); } }