0

I have a very simple company profile site that I am developing using JSF2, the only dynamic parameter that I am using is to determine the display language which is done using PrettyFaces. The site does not use any AJAX.

The only real reason for using JSF2 is the Facelets templating mechanism to maintain layout, CSS and JS across the site.

I want GAE to load the content from the JVM on first execution and then cache the content as static Facelets files for subsequent requests. I've noticed that static image files load much faster than any Java generated code, especially on the first request.

Are there any methods to achieve this functionality using appengine-web.xml or faces-config.xml ?

BenMorel
  • 34,448
  • 50
  • 182
  • 322
klonq
  • 3,535
  • 4
  • 36
  • 58

1 Answers1

1

AFAIK there is no way to have automatic out-of-the-box servlets/facelets response caching. However, you could always write your own caching servlet filter.

OTOH, all GAE responses are transparently cached by Google CDN cache. You can achieve caching of any response by adding Cache-control HTTP header to it.

Note that cache can not be programmatically expired, so if you set a cache time of an hour, then it'll take existing users an hour to get new content, so you should use this cautiously in your code.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • +1 for cache control, caching filter won't work because still needs to load servlet container. See similar http://stackoverflow.com/questions/5512634/caching-of-fake-static-content-which-is-actually-dynamic-on-gae-for-python – klonq Feb 08 '13 at 07:56