Integrate gzip with GWT

2019-07-16 11:44发布

问题:

I want to use gzip with GWT

Please suggest how do i compress my GWT nocache.js,cache.html and gwt.rpc files using gzip

Please help me

Thanks

回答1:

Generally, gzip is enabled on the server that your files are being hosted on, and you can do it for all files on your site rather than just those 3.

This site helps you test whether gzip is enabled on your site: http://www.whatsmyip.org/http_compression/

Here's how to turn gzip on with the Apache web server: http://httpd.apache.org/docs/2.0/mod/mod_deflate.html



回答2:

If you're using GWT 2.1 add <inherits name="com.google.gwt.precompress.Precompress"/> to your <Module>.gwt.xml file - GWT will then prescompress (using gzip) all static resources.

Jetty (6&7) will automatically serve the gzipped version if available...

GWT's RPCServlet checks if the client can handle gzipped content if it can it will be gzipped on the fly.