5 Replies Latest reply on Dec 17, 2009 1:42 PM by nbelaevski

    RF doesn't startup correctly (sometimes)

      Hello,

      I'm developping a application with Richfaces + Spring + JSF.

      Sometimes (generaly the first request after boot the server) the home page that I recive don't show the richfaces components, I can see the links and the buttons, but they aren't like richfaces skin.

       

      To solve this, I go to de login page (login page is render like home page, without richfaces skin), and when i login the navegator goes to a strange URI:

      http://localhost:8080/QuiQueQuanOn/a4j/g/3_3_0.GAorg/richfaces/renderkit/html/scripts/skinning.js.jsf

       

      not every times is the same uri, some times in place skining.js is spacer.gif ...

      and the page rendered is like:

       

      {var mediaName="rich-extended-skinning";var userAgent=navigator.userAgent;var skipNavigator=window.opera
      ||(userAgent.indexOf('AppleWebKit/')>-1&&userAgent.indexOf('Chrome/')==-1);if(!skipNavigator){var
      resetMedia=function(elt){var media=elt.getAttribute('media');if(mediaName==media){
      elt.removeAttribute('media');}};if(!window._RICH_FACES_SKINNING_ADDED_TO_BODY){
      var getElementByTagName=function(elt,name){var elements;try{elements=elt.selectNodes(".//*[local-name()=\""+
      name+"\"]");}catch(ex){try{elements=elt.getElementsByTagName(name);}catch(nf){}}
      return elements;};var f=function(){if(window.RICH_FACES_EXTENDED_SKINNING_ON){
      var styles=getElementByTagName(document,'link');if(styles){var l=styles.length;
      for(var i=0;i<l;i++){var elt=styles[i];resetMedia(elt);}}}};if(window.addEventListener)
      {window.addEventListener("load",f,false);}else{window.attachEvent("onload",f);}
      window._RICH_FACES_SKINNING_ADDED_TO_BODY=true;}

      if(!window._RICH_FACES_SKINNING_ADDED_TO_AJAX&&typeof A4J!="undefined"&&A4J.AJAX){
      A4J.AJAX.AddHeadElementTransformer(function(elt){if(window.RICH_FACES_EXTENDED_SKINNING_ON)
      {if(elt.tagName&&elt.tagName.toLowerCase()=='link'){resetMedia(elt);}}});
      window._RICH_FACES_SKINNING_ADDED_TO_AJAX=true;}}};

      after this, I rewrite the correct URI, and I can see the correct home page.

      I put here my web.xml, to end, specify that the welcome-file-list only have a page index.jsp,
      this is the only page in my webcontent with jsp, the other files are xhtml, and the extension that I use is jsf
      the index.jsp only do a redirect to home.jsf

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app id="WebApp_ID" version="2.5"
      xmlns="http://java.sun.com/xml/ns/javaee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      <display-name>QuiQueQuanOn</display-name>

      <context-param>
             <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
             <param-value>client</param-value>
      </context-param>

      <context-param>
             <param-name>org.richfaces.SKIN</param-name>
             <param-value>blueSky</param-value>
      </context-param>

      <context-param>
             <param-name>org.richfaces.CONTROL_SKINNING</param-name>
             <param-value>enable</param-value>
      </context-param>

      <context-param>
             <param-name>contextConfigLocation</param-name>
             <param-value>
                       /WEB-INF/applicationContext.xml
                     /WEB-INF/springSecurity-basic.xml</param-value>
      </context-param>

      <context-param>
           <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
             <param-value>.xhtml</param-value>
      </context-param>

      <context-param>
             <param-name>facelets.REFRESH_PERIOD</param-name>
             <param-value>2</param-value>
      </context-param>
      <context-param>
           <param-name>facelets.LIBRARIES</param-name>
           <param-value>/WEB-INF/richfaces.taglib.xml;</param-value>
      </context-param>

        <filter>
             <display-name>RichFaces Filter</display-name>
             <filter-name>richfaces</filter-name>
             <filter-class>org.ajax4jsf.Filter</filter-class>
      </filter>

      <filter>
             <filter-name>extensionsFilter</filter-name>
             <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
             <init-param>
                   <description>Set the size limit for uploaded files.
                      Format: 10 - 10 bytes
                              10k - 10 KB
                              10m - 10 MB
                              1g - 1 GB</description>
                   <param-name>uploadMaxFileSize</param-name>
                   <param-value>100m</param-value>
             </init-param>
             <init-param>
                <description>Set the threshold size - files
                              below this limit are stored in memory, files above
                              this limit are stored on disk.
          
                          Format: 10 - 10 bytes
                                  10k - 10 KB
                                  10m - 10 MB
                                  1g - 1 GB</description>
                <param-name>uploadThresholdSize</param-name>
                <param-value>100k</param-value>
            </init-param>
             <init-param>
                   <param-name>createTempFiles</param-name>
                   <param-value>true</param-value>
             </init-param>
      </filter>

      <filter>
             <filter-name>springSecurityFilterChain</filter-name>
             <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
      </filter>

      <!-- <filter-mapping>
             <filter-name>extensionsFilter</filter-name>
             <url-pattern>*.jsf</url-pattern>
      </filter-mapping>
        -->
      <filter-mapping>
             <filter-name>extensionsFilter</filter-name>
             <url-pattern>*.jsf</url-pattern>
      </filter-mapping>

      <filter-mapping>
             <filter-name>richfaces</filter-name>
             <servlet-name>Faces Servlet</servlet-name>
             <dispatcher>REQUEST</dispatcher>
             <dispatcher>FORWARD</dispatcher>
             <dispatcher>INCLUDE</dispatcher>
      </filter-mapping>

      <filter-mapping>
             <filter-name>springSecurityFilterChain</filter-name>
             <url-pattern>/*</url-pattern>
      </filter-mapping>

      <listener>
             <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
      </listener>

      <listener>
             <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
      </listener>
      <!--  End spring security filter-->

      <listener>
             <listener-class>org.springframework.security.ui.session.HttpSessionEventPublisher</listener-class>
      </listener>

      <servlet>
             <servlet-name>Faces Servlet</servlet-name>
             <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
             <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet-mapping>
             <servlet-name>Faces Servlet</servlet-name>
             <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>

      <welcome-file-list>
             <welcome-file>/index.jsp</welcome-file>
      </welcome-file-list>

      <login-config>
             <auth-method>BASIC</auth-method>
      </login-config>

      </web-app>

       

      thanks in advance