Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caching of CSS and JS resources in XPages when "use runtime optimized javascript and css resources"

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).

like image 278
Johann Echavarria Avatar asked Jan 03 '14 21:01

Johann Echavarria


2 Answers

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

like image 154
Per Henrik Lausten Avatar answered Nov 12 '22 22:11

Per Henrik Lausten


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.

like image 40
Panu Haaramo Avatar answered Nov 12 '22 23:11

Panu Haaramo