If you open up chrome dev tools, navigate to the network tab and select a path you can check the headers. For the request check the Accept-Encoding and if the client is able to handle gzip it will be set. If the server returns the content with gzip enabled the Content-Encoding it will contain gzip.
Enable gzip with planetj or ziplet
Ziplet, formally known as planetJ or pjl-comp-filter has been rebranded and is an open source library that contains a J2EE servlet filter which compresses data written to the response. There is multiple compression algorithms with various levels of configuration so be sure to check out the documentation.
First thing you will want to is import the dependency either with maven, gradle or manually add the jar to your class path.
Add the following deployment descriptor
Once you have imported the dependency, you will want to add the following entries to your web.xml deployment descriptor. Another option is to configure filter programmatically in spring and servlet 3.0. If you are using pjl-comp-filter substitute com.planetj.servlet.filter.compression.CompressingFilter for the ziplet classes below.
Verifying compression is enabled
How do you make sure that the compression is working? First check the request and response within chrome dev tools as shown above. Another option is to configure the servlet filter with initialization parameter and value. When passing in debug=true the filter will log additional information to the servlet log. When setting to true, be sure to update when deploying in a production environment as it could add unnecessary overhead.
Next create a statistics.jsp and drop it into the root of your web application. It will display values from the CompressionFilterStats such as total number of request/response compressed, compression ratio and key statistics.