10 Replies Latest reply on May 9, 2011 5:08 AM by eoin81

    Webflow integration

    eoin81

      Hi,

       

      In Webflow 2.0.6 the integration point with RichFaces 3.3.3 was :

       

      <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter">  

      <property name="ajaxHandler">

              <bean class="org.springframework.faces.richfaces.RichFacesAjaxHandler"/>                       

          </property>

      </bean>

       

      RichFacesAjaxHandler then uses org.ajax4jsf.context.AjaxContext in it's implementation.

       

      Upgrading to RichFaces 4.0.0 org.ajax4jsf.context.AjaxContext is not available.

       

      Is there a way around this? Thanks!

        • 1. Webflow integration
          eoin81

          Looks like this class (org.ajax4jsf.context.AjaxContext) was available in 4.X.Alpha2 (richfaces-core-api) but was not released in 4.X.Final.

           

          Was there any reason for this?

          • 2. Webflow integration
            nbelaevski

            Hi,

             

            Yes, this is a legacy class. org.richfaces.context.ExtendedPartialViewContext replaced it.

            • 3. Webflow integration
              eoin81

              Thanks for the clarification Nick.

               

              Spring-Faces (latest version 2.3) still references this legecy class.

               

              So i guess Integration between RichFaces 4.0.0.Final & Webflow wont be possible yet?

              • 4. Re: Webflow integration
                nbelaevski

                That's an extension over standard PartialViewContext of JSF 2. I haven't yet checked how SWF implements integration with JSF 2, need to try that.

                 

                I've created JIRA issue to cover that: https://issues.jboss.org/browse/RFPL-1430

                • 5. Webflow integration
                  eoin81

                  Thanks Nick.

                  I'd be interested in the outcome.

                  • 6. Re: Webflow integration
                    lfryc

                    Hello,

                     

                    RichFacesAjaxHandler is no longer needed for RichFaces 4.0 / JSF 2.

                     

                    You can see JIRA issue which covers integration for details.

                    • 7. Re: Webflow integration
                      eoin81

                      Hi Guys, Thanks a lot for the work on this.

                       

                      I followed the steps outlined in the JIRA issue...

                       

                      I attached the richfacesResourceHandler to the SimpleUrlHandlerMapping in my web-mvc-config.xml and that seems to work (I can see the trace output that maps the /rfRes/**=richfacesResourceHandler to the SimpleUrlHandlerMapping in the logs).

                       

                      However in Firebug (net tab) I get a bunch of 404 errors when rich faces looks for external resources (for example: **/rfRes/skinning.ecss.html?db=eAHL6rC8BQAEkAIG).

                       

                      My config looks the same (but obviously not the exact same!!) as the prototype (but I have some extra things in web xml like filters etc...).

                       

                      Do I need anything else to map the requests to resources successfully?

                       

                      My Template:

                      [CODE]

                       

                      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

                      <html xmlns="http://www.w3.org/1999/xhtml"

                          xmlns:h="http://java.sun.com/jsf/html"

                          xmlns:f="http://java.sun.com/jsf/core"

                          xmlns:c="http://java.sun.com/jsp/jstl/core"

                          xmlns:ui="http://java.sun.com/jsf/facelets">

                       

                          <f:view contentType="text/html">

                       

                              <h:head />

                       

                              <h:body>

                                  <ui:insert name="content" />                                               

                              </h:body>

                       

                          </f:view>

                       

                      </html>

                      [/CODE]

                       

                      web-mvc-config.xml

                       

                      [CODE]

                       

                      <?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:p="http://www.springframework.org/schema/p"

                          xmlns:mvc="http://www.springframework.org/schema/mvc"

                          xsi:schemaLocation="

                                 http://www.springframework.org/schema/beans

                                 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

                       

                        <bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">

                              <property name="flowExecutor" ref="flowExecutor" />

                        </bean>

                       

                        <!-- Maps request URIs to controllers -->

                        <bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">

                            <property name="order" value="-1" />

                          <property name="flowRegistry" ref="flowRegistry"/>     

                        </bean>

                       

                        <!-- Maps logical view names to Facelet templates (e.g. 'search' to '/WEB-INF/flows/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/flows/"/>

                          <property name="suffix" value=".xhtml"/>

                        </bean> 

                       

                        <bean name="richfacesResourceHandler" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />

                       

                        <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">

                          <property name="order" value="0" />

                          <property name="mappings">

                              <value>

                                  /rfRes/**=jsfResourceHandler

                                  /javax.faces.resources/**=richfacesResourceHandler               

                              </value>

                          </property>

                        </bean>

                       

                      </beans>

                       

                      [/CODE]

                      • 8. Re: Webflow integration
                        eoin81

                        Forget that guys.

                         

                        In my web xml I map requests from: <url-pattern>/test.html/*</url-pattern> to the dispatcher servler.

                         

                        Which confuses the mappings I have registered above for /rfRes/**=richfacesResourceHandler resulting in 404 errors for all requests to rich faces external resources ....

                         

                        Editing my url pattern to <url-pattern>/test/*</url-pattern> works fine but not sure why the above is causing issues!

                        • 9. Re: Webflow integration
                          lfryc

                          I have tried also following dispatcher servlet mapping and that worked for me without problem with resources:

                           

                           

                          <servlet-mapping>
                                              <servlet-name>Spring MVC Dispatcher Servlet</servlet-name>
                                              <url-pattern>/spring/*</url-pattern>
                                    </servlet-mapping>
                          
                          • 10. Re: Webflow integration
                            eoin81

                            Hi Lukáš

                             

                            This works fine:

                             

                            <servlet>
                                    <servlet-name>DispatcherServlet</servlet-name>
                                    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
                                    <init-param>
                                        <param-name>contextConfigLocation</param-name>
                                        <param-value>
                                            /WEB-INF/config/web-application-config.xml                
                                        </param-value>
                                    </init-param>
                                    <load-on-startup>1</load-on-startup>
                                </servlet>
                            
                                <servlet-mapping>
                                    <servlet-name>DispatcherServlet</servlet-name>
                                    <url-pattern>/test/*</url-pattern>
                                </servlet-mapping>
                            

                             

                            This dosent work:

                             

                            <servlet>
                                    <servlet-name>DispatcherServlet</servlet-name>
                                    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
                                    <init-param>
                                        <param-name>contextConfigLocation</param-name>
                                        <param-value>
                                            /WEB-INF/config/web-application-config.xml                
                                        </param-value>
                                    </init-param>
                                    <load-on-startup>1</load-on-startup>
                                </servlet>
                            
                                <servlet-mapping>
                                    <servlet-name>DispatcherServlet</servlet-name>
                                    <url-pattern>/test.html/*</url-pattern>
                                </servlet-mapping>
                            
                            
                            

                             

                             

                            By not working I mean, with the second mapping above, requests to external rich faces resources are not found (404).

                             

                            web-app-context.xml

                             

                             

                            <bean name="richfacesJsfResourceHandler" class="org.springframework.faces.webflow.JsfResourceRequestHandler" />
                            
                               <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
                                <property name="order" value="0" />
                                <property name="mappings">
                                    <value>
                                        /rfRes/**=richfacesJsfResourceHandler                                               
                                    </value>
                                </property>
                               </bean>