Board index JavaServer Faces General Caching the JavaScript files

Caching the JavaScript files

Components, Ajax Framework, Utilities and More.

Post 28 Dec 2010, 19:47

Posts: 52
Hi,

my website is very slow to load. I have analyzed the problem with FireBug Firefox extension, and found that the .js files loaded by PrimeFaces are up to 3 seconds to load, individually. Specifically, jquery.js, jquery-ui.js, menu.js, core.js and some accompanying CSS files are the reason for this.

It seems the files are never stored in the browser cache.

I am using
<context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>   
    <param-value>Production</param-value>
</context-param>


... so that is not the problem.

I'm using Glassfish 3.0.1 with PrimeFaces 2.2 RC2.

Has anyone else encountered this problem?

Thanks.
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 52
Anyone ? It seems the browser always reloads these files. They are never cached.
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 273
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)


Posts: 52
Hi and thanks for your response.

I'm having a hard time deriving a concrete solution from these threads.

I'm using Apache with mod_proxy in front of my Glassfish 3. Perhaps I should let it cache these resources instead?

Also, can you post a concrete example of your servlet filter code ?

Thanks.
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 15076
Location: Cybertron

As JSF 2.0 APIs are loading the resources, this questions is more related to the JSF impl not PrimeFaces library.
PrimeFaces Lead


Posts: 57
Location: Canada
in case someone is looking for an answer to this problem, after upgrading to mojarra-2.0.3 glassfish handled caching all the resources for me.. with mojarra-2.0.2 it did not.


Derek
PrimeFaces-3.0, Mojarra 2.0.4, GlassFish 3.1


Posts: 52
Hi,

You are correct. I just upgraded, and now everything is cached.

Is there a way to control the caching? Will it result in problems when I change some of the source files?

Thanks.
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 273
I you think Mojarra 2.0.3 automatically handle caching, can you please post the HTTP response headers of a typical static source?
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)


Posts: 52
It's just 304 NOT MODIFIED
Visit http://www.doc2pdf.net for a free, no need to register, .doc to .pdf and .pdf to .doc file conversion.


Posts: 273
304 NOT MODIFIED means your browser in contacting the server (and spending considerable time in establishing the connection) about the modified information, it is not the proper caching anyway.
JSF implementation: Mojarra V2.1.7
JSF component library: Primefaces V3.1.1
Server: GlassFish Open Source Edition V3.1.1 (build 12)

Next

Return to General