Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide support for Portlet 2.0 resource requests [SWF-1415] #601

Closed
spring-operator opened this issue Oct 29, 2010 · 7 comments
Closed

Comments

@spring-operator
Copy link
Contributor

Rossen Stoyanchev opened SWF-1415 and commented

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.


Affects: 2.2.1

6 votes, 6 watchers

@spring-operator
Copy link
Contributor Author

Paul Bacsik commented

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

@spring-operator
Copy link
Contributor Author

Florian Huonder commented

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?

@spring-operator
Copy link
Contributor Author

Rossen Stoyanchev commented

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.

@spring-operator
Copy link
Contributor Author

Michael Streubel commented

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.

@spring-operator
Copy link
Contributor Author

Rossen Stoyanchev commented

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.

@spring-operator
Copy link
Contributor Author

Florian Huonder commented

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

@spring-operator
Copy link
Contributor Author

Michael Streubel commented

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants