5

In XPages "use runtime optimized javascript and css resources" is a really cool feature because it joins all js files in just a file and all css files in just a css file.

However I noticed that the joined files are not cached (they always return status 200) and when you don't use "use runtime optimized javascript and css resources" they do (and return status 304).

Is good to reduce http requests but is bad always to retrieve from server the js and css files when they could be cached via ETag or Last-Modified http headers. Anybody knows if I'm missing something or if there is way to cache the joined files when you use the feature "use runtime optimized javascript and css resources" (application properties > XPages tab > Performance section > use runtime optimized javascript and css resources).

2
  • 2
    I just checked this on a 9.0.1 server and it looks like your statement isn't entirely true: the minified (CSS & JavaScript) resources are cached: by default the server adds an Expires header that's 10 days in the future. This will cause the browser to (during that time period) not perform a request for those resources at all and serve them from cache immediately. Jan 4, 2014 at 12:32
  • 1
    Agree. The resources are cached. Jan 4, 2014 at 14:40

2 Answers 2

7

The runtime optimized resources are cached.

Here's an example: enter image description here

If you are looking at the network activity and the response codes using Chrome Developer Tools, then make sure that it has not been set to "Disable cache (while DevTools is open)": enter image description here

1
1

Pressing Enter in URL bar will respect the Expires header and get the file from cache. But if you click reload or press F5 then the file will be reloaded. This is the behavior at least in Chrome and Firefox.

The cache works correctly when navigating from page to page.

1
  • 1
    Thank you for your answer. You got it, I was hitting f5 instead enter and the behaviour is what you say when I check previously "use runtime optimized javascript and css resources". What confused me is: when I uncheck "use runtime optimized javascript and css resources" and hit f5, the files (js and css) are cached and return 304 status. Finally I learned the difference beetwen (200 bfcache) and 304 and that's the http headers expires and If-Modified-Since . See my comment to @Per 's answer. Jan 7, 2014 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.