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.