Chris' SWI blog

« Yet another successf... | Main | Retrieving JSF Sessi... »

http://blogs.sun.com/chrisf/date/20080625 Wednesday June 25, 2008

JSF: Speeding up delivery of JSF pages to the client/browser using http compression and a caching filter

Howdy folks, well I thought I would share / combine a few of the techniques I found a month or two ago that I now use to speed up the delivery of JSF pages to the client. Leveraging caching of images/css and javascript objects and enabling HTTP 1.1 compression...A thanks goes out to Jean-Francois Arcand, lowec and Rafael Pereyra

Products involved:

  • GlassFish v2ur2
  • NetBeans 6.1
  • Visual JSF: 1.0.4
  • The steps involved:

  • Create a Filter to cache the following objects; *.png, *.css, *.js, *.gif, *.jpg, see forum posting here under heading Re: Creator and cache Jun 7, 2006 6:41 AM (reply 6 of 7)
  • Turn on HTTP 1.1 compression for GlassFish referencing Jean-Francois Arcand's Blog.
  • Thats all, doing so I was able to gain much faster client/server responses and improve the overall user experience.

    The only issue I have experienced doing so, was that every now and again I had to clean out my browser cache when I was testing a modified page.

    June 25th 2008 Update

    Since using the above technique to speed up delivery I noticed that there were a few issues with the "back" button in Internet Explorer and Safari browsers. I have now gone down the path of intoducing a phace listener in to the JSF framework; making sure that each page is not cached so that the page will be refreshed by the system. The phase listener was I found courtesy of http://turbomanage.wordpress.com/2006/08/08/disable-browser-caching-in-jsf/. I have updated the phase listener presented here slightly to introduce another meta tag, "EXPIRES" I set this to current date minus a year to make sure the systemrefreshes the content.

    The performance gain I was getting chaching pages hasn't actually hindered that much as all. When woodstock 4.2 was released, many performance improvements were seen, for more information see: http://www.nabble.com/Woodstock-4.2-Performance-tc15884700.html

    • GlassFish v2ur2
    • NetBeans 6.1
    • Visual JSF: 1.1.1

    Try out both ideas, se which one works better for you, let me know what you think.

    Cheerio!

     

    Comments:

    d

    Posted by 74.210.254.99 on April 20, 2009 at 01:40 AM EST #

    Post a Comment:
    • HTML Syntax: NOT allowed

    Valid HTML! Valid CSS!

    This is a personal weblog, I do not speak for my employer.