原文地址:http://tutorials.jenkov.com/java-servlets/gzip-servlet-filter.html
简介
A GZip Servlet Filter can be used to GZip compress content sent to a browser from a Java web application. This text will explain how that works, and contains a GZip Servlet Filter you can use in your own Java web applications. If you do not know what a Servlet filter is, read my text on Servlet Filters.
gzip servlet filter 可用来压缩网页内容。本文将介绍其如何工作,以及如何使用gzip servlet filter 在你的web服务器中。如果不了解servlet filter是什么可以参考这篇文章:Servlet Filters.
为什么要使用gzip压缩网页内容
GZip compressing HTML, JavaScript, CSS etc. makes the data sent to the browser smaller. This speeds up the download. This is especially beneficial for mobile phones where internet bandwidth may be limited. GZip compressing content adds a CPU overhead on the server and browser, but it is still speeding up the total page load compared to not GZip compressing.
gzip 压缩html、Javascript,css等等文件,目的是为了是发送到浏览器的数据更小,加速下载,这对于限制了带宽的移动端作用特别大。当然gzip增加了server端和浏览器端的cpu的压力,但是总体来说还是加速了页面的载入。