Jim Driscoll's Blog

Notes on Technology and the Web

Automatic compression of jsf.js

leave a comment »

Just a quick note that we’ve now added automatic compression of the jsf.js file served by JSF 2. The file size of jsf.js, 71k uncompressed, comes to about 16k compressed (there are a lot of comments in there).


There is no user action required to make this happen: If the Project stage is Development, the file is served uncompressed (for ease in debugging with something like Firebug), but if the Project stage is anything else, then the file is compressed (and essentially unreadable, since besides stripping all comments, variable names are stripped, as well as all line breaks).


To enable Project Stage as Development, place the following in your web.xml file:


    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

(This article originally published on my java.net blog on July 3, 2009.)

Written by jamesgdriscoll

February 9, 2010 at 9:00 PM

Posted in ajax, JSF

Leave a comment