Bug 760115 - RichFaces with Spring WebFlow requires additional configuration
Summary: RichFaces with Spring WebFlow requires additional configuration
Keywords:
Status: CLOSED INSUFFICIENT_DATA
Alias: None
Product: JBoss Enterprise WFK Platform 2
Classification: Retired
Component: RichFaces, Spring
Version: 2.0.0.DR05,2.0.0.DR06
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Brian Leathem
QA Contact: Karel Piwko
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-12-05 13:28 UTC by Karel Piwko
Modified: 2013-08-23 08:45 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
If you need to use Spring WebFlow 2.3 and RichFaces 4 together, you need to create an extra bean to resolve RichFace resources. This bean is not automatically included as part of faces:resources. If it is not present, a 404 error occurs 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 succeeds, and no error occurs.
Clone Of:
Environment:
Last Closed: 2013-08-09 14:02:14 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RFPL-1430 0 Major Resolved Integration: investigate integration of RichFaces 4 and Spring WebFlow 2015-06-13 04:28:23 UTC
Red Hat Issue Tracker WFK2-145 0 Major Closed RichFaces with Spring WebFlow requires additional configuration 2015-06-13 04:28:23 UTC

Description Karel Piwko 2011-12-05 13:28:05 UTC
Description of problem:

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. 


Version-Release number of selected component (if applicable):

Richfaces 4.1.0.CR1-redhat-1


How reproducible:

Always.

Steps to Reproduce:
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>
  
Actual results:

404 errors when when a CSS file is requested.


Expected results:

CSS and JS files are found.

Workaround:

Add following into configuration:

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

Comment 1 Karel Piwko 2011-12-05 13:29:06 UTC
Technical note will be required if this is not fixed in spring-faces.

Comment 2 Karel Piwko 2011-12-05 14:53:50 UTC
External reference https://jira.springsource.org/browse/SWF-1473

Comment 3 Rebecca Newton 2012-02-28 06:24:44 UTC
Where does that configuration change have to be added?

Comment 4 Rebecca Newton 2012-02-28 06:24:44 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Using Spring WebFlow 2.3 and RichFaces 4 together requires an extra bean to resolve RichFace resources, but this bean is not automatically part of faces:resources and gives a 404 error when a CSS file is requested. The workaround for this issue is to change the order of flowMapping to 2, and add the following configuration:
<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>

Comment 9 Karel Piwko 2012-06-22 07:56:05 UTC
This is in upstream issue, moving to ASSIGNED and unscheduling.

Comment 14 JBoss JIRA Server 2013-08-19 14:17:41 UTC
Pete Muir <pmuir.uk> made a comment on jira WFK2-145

[~jowilson] [~bleathem] can you check if this is still an issue for us?

Comment 15 JBoss JIRA Server 2013-08-22 21:18:06 UTC
Joshua Wilson <jowilson> made a comment on jira WFK2-145

[~bleathem] Here is a Spring WebFlow example that uses JSF.  Would you be able to modify it to use Richfaces to test this? 

https://github.com/SpringSource/spring-webflow-samples/tree/master/booking-faces

Comment 16 JBoss JIRA Server 2013-08-22 21:51:18 UTC
Brian Leathem <bleathem> made a comment on jira WFK2-145

I just did a quick scan through the snowdrop examples, and it appears we have a working RichFaces/Webflow demo:
https://github.com/snowdrop/snowdrop-examples/blob/master/sportsclub/spring-3_2/sportsclub-reservations-webflow/pom.xml

[~jowilson] can you run the above example with current versions (RichFaces 4.3.3.Final) and see if the problem persists?

Comment 17 JBoss JIRA Server 2013-08-22 22:48:53 UTC
Joshua Wilson <jowilson> made a comment on jira WFK2-145

I ran Sportsclub with RichFaces 4.3.3 and I didn't see anything wrong.  Looks like it works.

Comment 18 JBoss JIRA Server 2013-08-22 23:02:50 UTC
Brian Leathem <bleathem> made a comment on jira WFK2-145

Indeed, it looks like this has been resolved in Spring Webflow 2.4.0:
https://jira.springsource.org/browse/SWF-1473

Comment 19 JBoss JIRA Server 2013-08-23 00:50:04 UTC
Joshua Wilson <jowilson> made a comment on jira WFK2-145

[~bleathem] - Good find.

Comment 20 JBoss JIRA Server 2013-08-23 08:37:12 UTC
Marek Novotny <mnovotny> made a comment on jira WFK2-145

Cool, that we know what could be fixed. [~jowilson] Could you set devel_ack to + ?

We need to upgrade Spring WebFlow in WFK Spring BOMs, where it uses 2.3.1.RELEASE and 2.3.2.RELEASE.

Comment 21 JBoss JIRA Server 2013-08-23 08:45:45 UTC
Marek Schmidt <maschmid> made a comment on jira WFK2-145

Spring webflow 2.4 has not yet been released.


Note You need to log in before you can comment on or make changes to this bug.