1 Reply Latest reply on Sep 19, 2007 3:37 PM by Sergey Smirnov

    Performance problem with resources served from the classpath

    Olivier Lafontaine Newbie

      Hi,

      I'm using Ajax4jsf 1.1.1 and developed a custom Ajax4jsf component. My component uses a javascript file included in the classpath. It also depends on the prototype javascript library.

      I've create a class extending ClientScript to represent my javascript resource.

      My renderer extends AjaxContainerRenderer (since it is also a container) and overrides getAdditionalScripts like this:

       private static final InternetResource[] REQUIRED_SCRIPTS = {
       new PrototypeScript(),
       new SuggestSelectOneScript(),
       };
      
       @Override
       protected InternetResource[] getAdditionalScripts() {
       return REQUIRED_SCRIPTS;
       }
      


      My problem is that sometimes the page containing my component is extremely slow to be served. It seems related to serving my javascript file (also observed by entering the url to get the resource).

      When this happens, IE will display the page with javascript errors (it cannot find my javascript object) however on Firefox it will be just fine. Whenever this behavior happens once, every other request containing my component act the same. Sometimes it happens only on one of the browser (probably related to the browser caching the script).

      My app is running on Tomcat 5.5 and the problem is easily reproduced when debugging the app from Eclipse and changing some class so that the application context is reloaded.

      I did NOT create the META-INF/resources-config.xml file as it did not seem to be necessary. Could it be related?

      Any idea what I am doing wrong?

      Thank you!

      Olivier