Can you really send pre-compressed files which are contained inside an EARfile? More particularly, the jsp and js files inside the WAR file. I'm using Apache HTTP because the web server and although it is possible to switch on the deflate module and arrange it to utilize a pre-compressed version from the files, I must apply this to files which are contained inside an EAR file that's used to JBoss. This is because this content is very static and blending it quickly every time is very pricey when it comes to cpu time.

To be honest, I'm not entirely acquainted with how JBoss deploys these EAR files and 'serves' them. The gist of the items I wish to do is pre-compress the files contained within the war to ensure that when they're asked for they're delivered back towards the client with gzip for Content-Encoding.

Theoretically, you can compress them before packging them within the EAR, after which serve them track of a custom controller which adds the http header towards the response which informs the customer they are compressed, but that appears like lots of effort to visit.

Whenever you state that on-the-fly compression is very pricey, perhaps you have really measured it? Perhaps you have attempted asking for a lot of uncompressed pages, measured the cpu usage, then tied it again with compressed pages? I believe you might be over-calculating the impact. It uses very reasonable-intensity stream compression, involving little CPU assets.

You have to be certain that you've a real performance problem prior to going to such measures to mitigate it.

I do not frequent this website frequently and that i appear to possess left this thread hanging. Sorry about this. Used to do flourish in getting compression to my javascript and css files. Things I did was I precompress them within the ant build process while using gzip. Then i needed to spoof the title to eliminate the gzip extension. And So I had foo.js and compressed it into foo.js.gzip. I re-named this foo.js.gzip to foo.js which is the file that will get packed in to the WAR file. To ensure that handles the precompression part. To obtain this file offered up correctly, we have to tell the browser this file is compressed, through the content-encoding header from the http response. It was done using a output filter that's put on files that matched up the *.js extension (some Java/JBoss, WEB-INF/web.xml whether it helps. I am much less acquainted with this so sorry men).