I\'m developing an JSF web app on Tomcat, planning to use Seam in the near future, and I want to add compression of our web pages and resources (i.e. Javascript & CSS fi
GZIP filter will reduce the initial load time significantly.
You can additionally implement a cacheFilter to bring performance of your screens at par with JavaScript based UI (https://stackoverflow.com/a/35567540/5076414).
For client side components, you can use Primefaces which is JQuery based UI.
Simply add this to your
web.xml
gzipResponseFilter
org.omnifaces.filter.GzipResponseFilter
The threshold size in bytes. Must be a number between 0 and 9999. Defaults to 150.
threshold
150
The mimetypes which needs to be compressed. Must be a commaseparated string. Defaults to the below values.
mimetypes
text/plain, text/html, text/xml, text/css, text/javascript, text/csv, text/rtf,
application/xml, application/xhtml+xml, application/x-javascript, application/javascript, application/json,
image/svg+xml, image/gif, application/x-font-woff, application/font-woff2, image/png
gzipResponseFilter
/*
REQUEST
ERROR
java.lang.Throwable
/
And the following to your
pom.xml
org.omnifaces
omnifaces
1.11
To see if your contents are already usign gzip and cache, In your Google Chrome Browser -> right click on your screen -> inspect -> click network tab -> refresh your screen. Click on the images, icons, stylesheets and see if you see following in response header
Content-Encoding:gzip if the status of element is 200