5 Replies Latest reply on May 6, 2009 10:28 AM by ilya_shaikovsky

    weird problem with skinning.js in version 3.3.0 GA

    sliem

      I'm using RichFaces 3.3.0 GA in combination with WebFlow 2.0.6.

      Now everytime when I rebuild my web project and deploy, if some RichFaces component is runned for the first time the browser rederects me to a link:

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


      In the screen I'm also seeing a script:

      {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;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;}}};



      My first guess would be that something is wrong in the web.xml.
      I didn't initialised skinning in the first place. Don't want to. Here's my web.xml:

      <?xml version="1.0" encoding="ISO-8859-1"?>
       <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
       version="2.4">
      
       <!-- The master configuration file for this Spring web application -->
       <context-param>
       <param-name>contextConfigLocation</param-name>
       <param-value>
       /WEB-INF/config/web-application-config.xml
       </param-value>
       </context-param>
      
       <!-- Use JSF view templates saved as *.xhtml, for use with Facelets -->
       <context-param>
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
       <param-value>.xhtml</param-value>
       </context-param>
      
       <!-- Enables special Facelets debug output during development -->
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- Causes Facelets to refresh templates during development -->
       <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>1</param-value>
       </context-param>
       <context-param>
       <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
       </context-param>
      
       <!-- Enforce UTF-8 Character Encoding -->
       <filter>
       <filter-name>charEncodingFilter</filter-name>
       <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
       <init-param>
       <param-name>encoding</param-name>
       <param-value>UTF-8</param-value>
       </init-param>
       <init-param>
       <param-name>forceEncoding</param-name>
       <param-value>true</param-value>
       </init-param>
       </filter>
       <filter-mapping>
       <filter-name>charEncodingFilter</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
      
       <!-- Enables Spring Security -->
       <!--Filter Config -->
       <filter>
       <filter-name>springSecurityFilterChain</filter-name>
       <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
       </filter>
       <filter-mapping>
       <filter-name>springSecurityFilterChain</filter-name>
       <url-pattern>/*</url-pattern>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       </filter-mapping>
      
      
      
      
       <!-- Making the RichFaces skin spread to standard HTML controls -->
       <!--context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>DEFAULT</param-value>
       </context-param>
       <context-param>
       <param-name>org.richfaces.CONTROL_SKINNING</param-name>
       <param-value>disable</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-mapping>
       <filter-name>richfaces</filter-name>
       <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>FORWARD</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
       <!-- dispatcher>ERROR</dispatcher -->
       </filter-mapping>
      
       <!-- Loads the Spring web application context -->
       <listener>
       <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
       </listener>
      
       <!-- Serves static resource content from .jar files such as spring-faces.jar -->
       <servlet>
       <servlet-name>Resources Servlet</servlet-name>
       <servlet-class>org.springframework.js.resource.ResourceServlet</servlet-class>
       <load-on-startup>0</load-on-startup>
       </servlet>
      
       <!-- Map all /resources requests to the Resource Servlet for handling -->
       <servlet-mapping>
       <servlet-name>Resources Servlet</servlet-name>
       <url-pattern>/resources/*</url-pattern>
       </servlet-mapping>
      
       <!-- The front controller of this Spring Web application, responsible for handling all application requests -->
       <servlet>
       <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
       <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
       <init-param>
       <param-name>contextConfigLocation</param-name>
       <param-value></param-value>
       </init-param>
       <load-on-startup>2</load-on-startup>
       </servlet>
      
       <!-- Map all /spring requests to the Dispatcher Servlet for handling -->
       <servlet-mapping>
       <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
       <url-pattern>/webathena/*</url-pattern>
       </servlet-mapping>
      
       <!-- Just here so the JSF implementation can initialize, *not* used at runtime -->
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <!-- Just here so the JSF implementation can initialize -->
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       </welcome-file-list>
       </web-app>
      


      Maybe someone can help me out with this weird issue.

      Thanks.


        • 1. Re: weird problem with skinning.js in version 3.3.0 GA
          ilya_shaikovsky

          at first please try to move richfaces-filter definition to the first place of filter defintions in web.xml.

          • 2. Re: weird problem with skinning.js in version 3.3.0 GA
            sliem

             

            "ilya_shaikovsky" wrote:
            at first please try to move richfaces-filter definition to the first place of filter defintions in web.xml.


            Just tried.
            That didn't solved the problem unfortunately.

            • 3. Re: weird problem with skinning.js in version 3.3.0 GA
              nbelaevski

              I guess this:

              <!--Filter Config -->
               <filter>
               <filter-name>springSecurityFilterChain</filter-name>
               <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
               </filter>
               <filter-mapping>
               <filter-name>springSecurityFilterChain</filter-name>
               <url-pattern>/*</url-pattern>
               <dispatcher>REQUEST</dispatcher>
               <dispatcher>FORWARD</dispatcher>
               <dispatcher>INCLUDE</dispatcher>
               </filter-mapping>
              is the reason. Try to remove and check.

              • 4. Re: weird problem with skinning.js in version 3.3.0 GA
                fdemilde

                Hi,
                we faced exactly the same issue.
                As a workaround, we choose to not apply security on the a4j resources (refer to snippet of spring security-config.xml file)

                <?xml version="1.0" encoding="UTF-8"?>
                <beans xmlns="http://www.springframework.org/schema/beans"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xmlns:security="http://www.springframework.org/schema/security"
                 xsi:schemaLocation="
                 http://www.springframework.org/schema/beans
                 http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
                 http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd" >
                
                 <security:http auto-config="true">
                 <!-- other rules -->
                 <security:intercept-url pattern="/prod/a4j/**" filters="none"/>
                 </security:http>
                
                 <!-- other security config settings -->
                </beans>



                • 5. Re: weird problem with skinning.js in version 3.3.0 GA
                  ilya_shaikovsky

                  look also to this and related to it https://jira.jboss.org/jira/browse/RF-3930