Uploaded image for project: 'JBoss WFK 2'
  1. JBoss WFK 2
  2. WFK2-145

RichFaces with Spring WebFlow requires additional configuration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Partially Completed
    • Affects Version/s: 2.0.0.GA, 2.1.0.GA, 2.2.0.GA, 2.3.0.GA, 2.4.0.GA, 2.5.0.GA, 2.6.0.GA
    • Fix Version/s: 2.6.0.CR1
    • Component/s: RichFaces, Spring
    • Labels:
      None
    • Environment:

      Richfaces 4.1.0.CR1-redhat-1

    • Target Release:
    • Steps to Reproduce:
      Hide

      1. Include RichFaces 4.1
      2. Include Spring WebFlow 2.3
      3. Configure Spring WF with following:

      <?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:faces="http://www.springframework.org/schema/faces"
          xsi:schemaLocation="
             	http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
             	http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">
       
          <faces:resources />
       
          <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" -->
          <bean id="flowMapping" class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
              <property name="order" value="1" />
              <property name="flowRegistry" ref="flowRegistry" />
              <property name="defaultHandler">
                  <!-- If no flow match, map path to a view to render; e.g. the "/intro" path would map to the view named "intro" -->
                  <bean class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
              </property>
          </bean>
       
          <!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' to '/WEB-INF/search.xhtml' -->
          <bean id="faceletsViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
              <property name="viewClass" value="org.springframework.faces.mvc.JsfView" />
              <property name="prefix" value="/WEB-INF/" />
              <property name="suffix" value=".xhtml" />
          </bean>
       
          <!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations -->
          <bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />
       
          <!-- Dispatches requests mapped to flows to FlowHandler implementations -->
          <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
              <property name="flowExecutor" ref="flowExecutor" />
          </bean>
       
      </beans>
      

      Show
      1. Include RichFaces 4.1 2. Include Spring WebFlow 2.3 3. Configure Spring WF with following: <? 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:faces = "http://www.springframework.org/schema/faces" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/faces http://www.springframework.org/schema/faces/spring-faces-2.2.xsd">   < faces :resources />   <!-- Maps request paths to flows in the flowRegistry; e.g. a path of /hotels/booking looks for a flow with id "hotels/booking" --> < bean id = "flowMapping" class = "org.springframework.webflow.mvc.servlet.FlowHandlerMapping" > < property name = "order" value = "1" /> < property name = "flowRegistry" ref = "flowRegistry" /> < property name = "defaultHandler" > <!-- If no flow match, map path to a view to render; e.g. the "/intro" path would map to the view named "intro" --> < bean class = "org.springframework.web.servlet.mvc.UrlFilenameViewController" /> </ property > </ bean >   <!-- Maps logical view names to Facelet templates in /WEB-INF (e.g. 'search' to '/WEB-INF/search.xhtml' --> < bean id = "faceletsViewResolver" class = "org.springframework.web.servlet.view.UrlBasedViewResolver" > < property name = "viewClass" value = "org.springframework.faces.mvc.JsfView" /> < property name = "prefix" value = "/WEB-INF/" /> < property name = "suffix" value = ".xhtml" /> </ bean >   <!-- Dispatches requests mapped to org.springframework.web.servlet.mvc.Controller implementations --> < bean class = "org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter" />   <!-- Dispatches requests mapped to flows to FlowHandler implementations --> < bean class = "org.springframework.faces.webflow.JsfFlowHandlerAdapter" > < property name = "flowExecutor" ref = "flowExecutor" /> </ bean >   </ beans >
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      Add following into configuration if you use Spring 3.x:

          <!-- RichFaces resource handling https://issues.jboss.org/browse/RFPL-1430 -->
          <bean name="richfacesResourceHandler" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />
       
          <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
              <property name="order" value="1" />
              <property name="mappings">
                  <value>
                      /rfRes/**=richfacesResourceHandler
                  </value>
              </property>
          </bean>
      

      and change the order of flowMapping to 2.

      Show
      Add following into configuration if you use Spring 3.x: <!-- RichFaces resource handling https://issues.jboss.org/browse/RFPL-1430 --> < bean name = "richfacesResourceHandler" class = "org.springframework.faces.webflow.JsfResourceRequestHandler" />   < bean class = "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" > < property name = "order" value = "1" /> < property name = "mappings" > < value > /rfRes/**=richfacesResourceHandler </ value > </ property > </ bean > and change the order of flowMapping to 2.
    • Affects:
      Release Notes
    • Release Notes Docs Status:
      Documented as Known Issue
    • Release Notes Text:
      Hide
      When using Spring WebFlow 2.3 with Spring 3.x and RichFaces 4, an extra bean service must be created to resolve RichFace resources. This bean is not automatically included as part of faces:resources, causing a 404 error to occur when a CSS file is requested. To work around this issue, change the order of the flowMapping so that RichFaces has higher priority than the user-generated flow (the lower number gets higher priority), and add the following bean to your application:
      <bean name="richfacesResourceHandler"
      class="org.springframework.faces.webflow.JsfResourceRequestHandler" />

      <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="order" value="1" />
        <property name="mappings">
          <value>
             /rfRes/**=richfacesResourceHandler
          </value>
        </property>
      </bean>

      After this configuration change, the request for the CSS file loads as expected.
      Show
      When using Spring WebFlow 2.3 with Spring 3.x and RichFaces 4, an extra bean service must be created to resolve RichFace resources. This bean is not automatically included as part of faces:resources, causing a 404 error to occur when a CSS file is requested. To work around this issue, change the order of the flowMapping so that RichFaces has higher priority than the user-generated flow (the lower number gets higher priority), and add the following bean to your application: <bean name="richfacesResourceHandler" class="org.springframework.faces.webflow.JsfResourceRequestHandler" /> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">   <property name="order" value="1" />   <property name="mappings">     <value>        /rfRes/**=richfacesResourceHandler     </value>   </property> </bean> After this configuration change, the request for the CSS file loads as expected.

      Description

      In order to use Spring WebFlow 2.3 with RichFaces 4 you have to define an extra bean to resolve RichFaces resources. This bean is not automatically a part of faces:resources.

      How reproducible:
      Always.

      Actual results:
      404 errors when when a CSS file is requested.

      Expected results:
      CSS and JS files are found.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  jowilson Joshua Wilson
                  Reporter:
                  manaRH Marek Novotny
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  9 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: