Caching the JavaScript files

UI Components for JSF
primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

28 Dec 2010, 19:47

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

Code: Select all

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

primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

02 Jan 2011, 22:31

Anyone ? It seems the browser always reloads these files. They are never cached.

User avatar
MISS_DUKE
Posts: 273
Joined: 08 Aug 2010, 05:52

03 Jan 2011, 07:31

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

primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

04 Jan 2011, 00:59

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.

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Jan 2011, 13:04

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

derek
Posts: 57
Joined: 24 Aug 2010, 00:56
Location: Canada

07 Jan 2011, 21:59

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

primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

07 Jan 2011, 22:39

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.

User avatar
MISS_DUKE
Posts: 273
Joined: 08 Aug 2010, 05:52

08 Jan 2011, 02:48

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)

primehthb
Posts: 52
Joined: 12 Dec 2010, 22:19

08 Jan 2011, 12:03

It's just 304 NOT MODIFIED

User avatar
MISS_DUKE
Posts: 273
Joined: 08 Aug 2010, 05:52

08 Jan 2011, 12:18

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)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 19 guests