Spring Web Flow
  1. Spring Web Flow
  2. SWF-1415

Provide support for Portlet 2.0 resource requests

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.2.1
    • Fix Version/s: 2.3.0
    • Component/s: Integration: Portlet
    • Labels:
      None

      Description

      The FlowHandlerAdapter.handleResource() method currently has an implementation that is equivalent to the Portlet 2.0 GenericPortlet. This method should be changed to have processing similar to that of action requests. A good demonstration would be to add some Ajax requests with partial rendering to the portlet samples.

        Activity

        Hide
        Paul Bacsik added a comment -

        It would be fine if resources could be served as a webflow action and Portlet Events would be handled the same way.

        Show
        Paul Bacsik added a comment - It would be fine if resources could be served as a webflow action and Portlet Events would be handled the same way.
        Hide
        Florian Huonder added a comment -

        Am I right in the assumtion that after completion of this issue I am able to use Primefaces 1.1 within a Portlet-Environment with Ajax? Meaning I am able register the PrimeFacesAjaxHandler somehow?

        Show
        Florian Huonder added a comment - Am I right in the assumtion that after completion of this issue I am able to use Primefaces 1.1 within a Portlet-Environment with Ajax? Meaning I am able register the PrimeFacesAjaxHandler somehow?
        Hide
        Rossen Stoyanchev added a comment -

        Support for resource requests has been checked in. If anyone wants to try it, it will be available in the next nightly snapshot on http://maven.springframework.org/snapshot.

        JSP users can use the JSP tag <portlet:resourceURL> to create a resource URL for Ajax requests:

        <portlet:resourceURL var="changeSearchUrl">
            <portlet:param name="execution" value="${flowExecutionKey}" />
            <portlet:param name="_eventId" value="changeSearch" />
        </portlet:resourceURL>
        

        JSF users will likely need to use a library that supports the use of resource URLs. It would be great it anyone has any experience to share in this regard.

        Show
        Rossen Stoyanchev added a comment - Support for resource requests has been checked in. If anyone wants to try it, it will be available in the next nightly snapshot on http://maven.springframework.org/snapshot . JSP users can use the JSP tag <portlet:resourceURL> to create a resource URL for Ajax requests: <portlet:resourceURL var= "changeSearchUrl" > <portlet:param name= "execution" value= "${flowExecutionKey}" /> <portlet:param name= "_eventId" value= "changeSearch" /> </portlet:resourceURL> JSF users will likely need to use a library that supports the use of resource URLs. It would be great it anyone has any experience to share in this regard.
        Hide
        Michael Streubel added a comment -

        I wasn't able to follow your maven link. Anyway, I have a working extension of SWF and PrimeFaces (unfortunately 1.1, not 2.x) allowing for AJAX and PPR by means of resource requests. However, it will be hard to expose source code because it is not open source, however we can try to share thoughts.

        Show
        Michael Streubel added a comment - I wasn't able to follow your maven link. Anyway, I have a working extension of SWF and PrimeFaces (unfortunately 1.1, not 2.x) allowing for AJAX and PPR by means of resource requests. However, it will be hard to expose source code because it is not open source, however we can try to share thoughts.
        Hide
        Rossen Stoyanchev added a comment -

        Hi Michael, the maven link cannot be browsed directly but should be usable in a Maven repository element. There is a way to browser interface for the same repository. It is https://s3browse.springsource.com/browse/maven.springframework.org/snapshot/.

        I would be interested to hear your experience of integrating SWF and PrimeFaces. If it makes sense feel free to open tickets in JIRA for what we could do further in Web Flow or you can also contact me directly.

        Show
        Rossen Stoyanchev added a comment - Hi Michael, the maven link cannot be browsed directly but should be usable in a Maven repository element. There is a way to browser interface for the same repository. It is https://s3browse.springsource.com/browse/maven.springframework.org/snapshot/ . I would be interested to hear your experience of integrating SWF and PrimeFaces. If it makes sense feel free to open tickets in JIRA for what we could do further in Web Flow or you can also contact me directly.
        Hide
        Florian Huonder added a comment -

        Hi Michael, Rossen

        The case that Michael describes is exactly what we need.
        We are facing the problem that we want a PrimeFaces 1.1 application (with webflow) to be able to make Ajax.
        We do not need a working example or something.
        I would be glad whan you could share some thoughts on your "how to".

        Would be great to hear something from you.

        Best regards,
        Florian

        Show
        Florian Huonder added a comment - Hi Michael, Rossen The case that Michael describes is exactly what we need. We are facing the problem that we want a PrimeFaces 1.1 application (with webflow) to be able to make Ajax. We do not need a working example or something. I would be glad whan you could share some thoughts on your "how to". Would be great to hear something from you. Best regards, Florian
        Hide
        Michael Streubel added a comment - - edited

        Well, first of all it was an indispensable precondition that the frameworks (SWF and PrimeFaces) don't get patched.
        Everything is a framework extension.

        Perhaps you can glimpse the implementation strategy if I show you the basics of the SWF extension configuration:

            <webflow:flow-executor id="flowExecutor">
                <webflow:flow-execution-listeners>
                	<webflow:listener ref="ajaxFlowExecutionListener" />
                	<webflow:listener ref="facesContextListener"/>
                </webflow:flow-execution-listeners>
            </webflow:flow-executor>
        
           <webflow:flow-registry id="flowRegistry"
            		flow-builder-services="primefacesFlowBuilderServices"
                        ..............
        
            <webflow:flow-builder-services id="primefacesFlowBuilderServices" view-factory-creator="viewFactoryCreator"
            			conversion-service="facesConversionService"/>
        
           <bean id="viewFactoryCreator" class="xxxxxx.portal.resources.spring.webflow.extension.PortletViewFactoryCreator"/>
        
           <bean id="ajaxFlowExecutionListener" class="xxxxxx.portal.resources.spring.webflow.extension.AjaxFlowExecutionListener"/>
        
        

        and the main entry point: The FlowHandlerAdapter extension

        
           <bean id="handlerAdapter" class="xxxxxx.portal.resources.spring.webflow.extension.AjaxPortletFlowHandlerAdapter">
        		<property name="flowExecutor" ref="flowExecutor"/>
        		<property name="flowUrlHandler">
        			<bean class="xxxxxx.portal.resources.spring.webflow.extension.DefaultPortletAjaxFlowUrlHandler"/>
        		</property>
        		<property name="ajaxPortletHandler">
        	        <bean class="xxxxxx.portal.resources.spring.webflow.extension.PrimeFacesAjaxPortletHandler"/>
        	    </property>
        
          </bean>
        

        All that enables SWF to handle Portlet ResourceRequests in such a way that they get propagated down into a derivation of the PrimeFacesPhaseListener.

        It must be guaranteed that the latter gets switched off in favour of its derivation which is able to handle ResourceResponses in contrast to its parent. Here comes into play the beauty of PrimeFaces' Ajax implementation which on the serverside is solely handled by this class.

        Finally, the whole setup is completed by extensions of PrimeFaces components and its underlying JavaScript resources to the effect that they also are able to send JSR 286 ResourceRequests instead of ActionRequests.

        All that was developed under PrimeFaces 1.1 and SWF 2.1.0 but definitely works well under SWF 2.2.1/2.3.0.

        Show
        Michael Streubel added a comment - - edited Well, first of all it was an indispensable precondition that the frameworks (SWF and PrimeFaces) don't get patched. Everything is a framework extension. Perhaps you can glimpse the implementation strategy if I show you the basics of the SWF extension configuration: <webflow:flow-executor id= "flowExecutor" > <webflow:flow-execution-listeners> <webflow:listener ref= "ajaxFlowExecutionListener" /> <webflow:listener ref= "facesContextListener" /> </webflow:flow-execution-listeners> </webflow:flow-executor> <webflow:flow-registry id= "flowRegistry" flow-builder-services= "primefacesFlowBuilderServices" .............. <webflow:flow-builder-services id= "primefacesFlowBuilderServices" view-factory-creator= "viewFactoryCreator" conversion-service= "facesConversionService" /> <bean id= "viewFactoryCreator" class= "xxxxxx.portal.resources.spring.webflow.extension.PortletViewFactoryCreator" /> <bean id= "ajaxFlowExecutionListener" class= "xxxxxx.portal.resources.spring.webflow.extension.AjaxFlowExecutionListener" /> and the main entry point: The FlowHandlerAdapter extension <bean id= "handlerAdapter" class= "xxxxxx.portal.resources.spring.webflow.extension.AjaxPortletFlowHandlerAdapter" > <property name= "flowExecutor" ref= "flowExecutor" /> <property name= "flowUrlHandler" > <bean class= "xxxxxx.portal.resources.spring.webflow.extension.DefaultPortletAjaxFlowUrlHandler" /> </property> <property name= "ajaxPortletHandler" > <bean class= "xxxxxx.portal.resources.spring.webflow.extension.PrimeFacesAjaxPortletHandler" /> </property> </bean> All that enables SWF to handle Portlet ResourceRequests in such a way that they get propagated down into a derivation of the PrimeFacesPhaseListener. It must be guaranteed that the latter gets switched off in favour of its derivation which is able to handle ResourceResponses in contrast to its parent. Here comes into play the beauty of PrimeFaces' Ajax implementation which on the serverside is solely handled by this class. Finally, the whole setup is completed by extensions of PrimeFaces components and its underlying JavaScript resources to the effect that they also are able to send JSR 286 ResourceRequests instead of ActionRequests. All that was developed under PrimeFaces 1.1 and SWF 2.1.0 but definitely works well under SWF 2.2.1/2.3.0.

          People

          • Assignee:
            Rossen Stoyanchev
            Reporter:
            Rossen Stoyanchev
          • Votes:
            6 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development