I have Primefaces 4.0 working on top of JBoss 7.1.1.Final. I use google webutilities ( https://code.google.com/p/webutilities/ ) to compress and merge javascript and CSS files. When I run the properties of the Sword page on my page, all my custom css and js files seem compressed and do not cause any problems on the page. But then again, all Primefaces resources seem to skip all the filters. Here is my webutilities configuration:
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>com.googlecode.webutilities.filters.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>force</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>ignoreURLPattern</param-name>
<param-value>.*\.(png|gif|jpg|tiff|bmp|mpg|jpeg)</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<filter>
<filter-name>responseCacheFilter</filter-name>
<filter-class>com.googlecode.webutilities.filters.ResponseCacheFilter</filter-class>
<init-param>
<param-name>acceptMIMEPattern</param-name>
<param-value>text/javascript,application/javascript,text/css</param-value>
</init-param>
<init-param>
<param-name>acceptURLPattern</param-name>
<param-value>.*\.(js|json|css).*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>responseCacheFilter</filter-name>
<url-pattern>*.js</url-pattern>
<url-pattern>*.json</url-pattern>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter>
<filter-name>compressionFilter</filter-name>
<filter-class>com.googlecode.webutilities.filters.CompressionFilter</filter-class>
<init-param>
<param-name>compressionThreshold</param-name>
<param-value>512</param-value>
</init-param>
<init-param>
<param-name>ignoreURLPattern</param-name>
<param-value>.*\.(png|gif|jpg|tiff|bmp|mpg|jpeg).*</param-value>
</init-param>
<init-param>
<param-name>ignoreMimes</param-name>
<param-value>images/*,video/*, multipart/x-gzip</param-value>
</init-param>
<init-param>
<param-name>ignoreUserAgentsPattern</param-name>
<param-value>.*MSIE.*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>compressionFilter</filter-name>
<url-pattern>*</url-pattern>
</filter-mapping>
<filter>
<filter-name>yuiMinFilter</filter-name>
<filter-class>com.googlecode.webutilities.filters.YUIMinFilter</filter-class>
<init-param>
<param-name>lineBreak</param-name>
<param-value>8000</param-value>
</init-param>
<init-param>
<param-name>acceptMIMEPattern</param-name>
<param-value>text/javascript,application/javascript,text/css</param-value>
</init-param>
<init-param>
<param-name>acceptURLPattern</param-name>
<param-value>.*\.(js|json|css).*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>yuiMinFilter</filter-name>
<url-pattern>*.js</url-pattern>
<url-pattern>*.json</url-pattern>
<url-pattern>*.css</url-pattern>
</filter-mapping>
I also tried setting the following parameters in web.xml:
<context-param>
<param-name>org.primefaces.extensions.DELIVER_UNCOMPRESSED_RESOURCES</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Production</param-value>
</context-param>
But still the output from the PageSpeed page gives me the following, how to improve the performance of the page:
**Enable compression for the following resources to reduce their transfer size by 567.5KiB (75% reduction).**
Compressing http:
Compressing http:
Compressing http:
Compressing http:
Compressing http:
Compressing http:
Compressing http:
**Minify JavaScript for the following resources to reduce their size by 84.4KiB (20% reduction).**
Minifying http:
Minifying http:
Minifying http:
**Minify CSS for the following resources to reduce their size by 4.1KiB (8% reduction).**
Minifying http:
Minifying http:
**605.3KiB of JavaScript is parsed during initial page load. Defer parsing JavaScript to reduce blocking of page rendering.**
http:
http:
http:
http:
http:
http:
http:
http:
http:
Primefaces + Primefaces. , WebUtilities , , ? !