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 API 2.0 and JSF 1.2 [SWF-1379] #565
Comments
Rossen Stoyanchev commented The Portlet/JSF booking sample (swf-booking-portlet-faces) now works with Portlet 2.0 API and JSF 1.2 dependencies (both Mojarra and MyFaces were tested). The support is based on Web Flow's own integration with the Portlet API (and not on the Portlet Bridge for JSF), which has now been extended to ensure JSF requests work with Portlet specific structures such as PortletContext, PortletRequest, and PortletResponse. The dependency on the Portlet Bridge for JSF has been removed. |
Paul Bacsik commented I checked this out by maven 2.2.0.BUILD-SNAPSHOT with spring 3.0.4.RELEASE, myfaces 1.2.8 and liferay 5.5 but got an Exception on the first rendering of the view: |
Rossen Stoyanchev commented Check to make sure you're not missing the FlowFacesContextLifecycleListener in you webflow:executor configuration (see the booking-portlet-faces sample for an example). I've made some improvements to simplify the configuration #561. Those should be available after tonight's build. By the way the nightly build last night failed with a strange compiler error so you haven't really picked up the changes yet. There should be a good snapshot by tomorrow: |
Rossen Stoyanchev commented A snapshot build is now available that contains the changes for this issue. You'll want to force maven to check for udpated snapshots (mvn -U) when building. |
Paul Bacsik commented Don't know exactly whether maven is up to date, I downloaded *-50 libs and it works wonderful without any portlet-bridge implementation. Into faces-config I copied this from samples: <view-handler>org.springframework.faces.webflow.application.portlet.PortletFaceletViewHandler</view-handler> and of course the FlowFacesContextLifecycleListener in the mvc config is needed. Thank you for the good job. |
Rossen Stoyanchev commented Thanks for the feedback! |
David Godin commented Dear experts, The error trace is: DEBUG: org.springframework.web.portlet.DispatcherPortlet - DispatcherPortlet with name 'swfbookingfaces' received render request
|
Rossen Stoyanchev commented The most likely cause for the above error missing or invalid configuration in web.xml or faces-config.xml. Given that you're using the sample then the configuration should be okay. I can't reach the build server right now to verify if CI-52 has the changes. I recommend trying downloading version 2.2.0.RC1 that was released last week: http://www.springsource.com/download/community I've also seen this error happen when some other exception further up occurred during start up causing JSF to fail to initialize. Later on when the FactoryFinder is used it gives the above error. It could be things like ClassNotFoundException or any other exception. Do check the logs further up during for other previous exceptions. |
David Godin commented Thanks Rossen for your suggestions.... I downloaded the version 2.2.0.RC1 but I still have the same error, and I couldn't discover any "ClassNotFoundException" in the log...
Many thanks in advance, |
Rossen Stoyanchev commented If you downloaded spring-webflow-2.2.0.RC1-with-dependencies.zip then: cd projects/build-spring-webflow
So there no other exceptions in the log? Strange. And you haven't changed of the configuration... It's should be something failing during the initialization of JSF. If you have the option to start in a debugger, there is an option to break when exceptions occur. |
Mindaugas Plukas commented Does this solution cover AJAX processing, in particular does it support RichFaces framework? |
Rossen Stoyanchev commented I can't think of any reason why it shouldn't. |
Mindaugas Plukas commented Thanks for reply. After taking a brief look into the code I was not sure what controller AJAX requests will go to. Very likely that I missed something. Could you please elaborate this point a little. Thank you. |
Rossen Stoyanchev commented Good points. The Portlet 2.0 spec has a section on "Serving Fragments through Portlets" (PLT.14). As you pointed out those would have to come in as resource requests. They go through the portal as all other requests but only the target portlet would be invoked to generate partial content. The PortletHandlerMapping should then route the request through to Web Flow's FlowHandlerAdapter, which currently implements handleResource() as follows: if (request.getResourceID() != null) { This method may need to be modified to have logic similar to the handleAction/handleResource methods. Have you been able to confirm what URLs are created by the RichFaces ajax components? I guess we'll just need to have a working sample that sends resource requests via Ajax and see if the handleResource method needs to be updated. |
Mindaugas Plukas commented We have run a small test based on booking-portlet-faces sample with RichFaces/Ajax4Jsf components added. As expected, AJAX request URLs (generated by <a4j> tags) were rendered as portlet action URLs (which is wrong as discussed earlier). Additional problem with RichFaces is that there is no way to set up org.ajax4jsf.Filter, since it is servlet filter, but all SWF requests go through DispatcherPortlet (we added org.ajax4jsf.Filter to web.xml without meaningful mapping just to initialize A4J environment.) Seems that because of this RichFaces AJAX components were not active. Concerning AJAX requests, SWF - Portlet support should be improved like this: Concerning RichFaces support By the way , JSF portlet with RichFaces and JBoss portlet bridge employs portlet resource URLs for <a4j> requests. |
Rossen Stoyanchev commented Thanks for the detailed comments. This just needs to be tried out. If you have any sample code that would be useful feel free to attach. I'm not quite sure how the issue with the a4j tags generating portlet action URLs could be resolved. As for the org.ajax4jsf.Filter I wonder how this works (or if it works) with the Rich Faces Portlet Bridge for JSF version 2. |
Rossen Stoyanchev commented I've added #601 for the handling of portlet resource requests. I'm still not sure how a ViewHanlder.getActionURL() would know when to return a portlet resource request URL as indicated in #2 above but #601 is certainly needed regardless of that. |
Rossen Stoyanchev opened SWF-1379 and commented
JSF portlets are presently considered experimental in Web Flow 2. The upgrade to Spring 3 also meant Portlet API 2.0 is a required dependency. While there are portlet bridge implementations supporting Portlet API 2.0 and JSF 1.2 the JSR-329 they are based on is not yet final.
Furthermore Web Flow and a Portlet Bridge implementation both drive the JSF lifecycle. There is a degree of overlap between the two. Hence we need to determine how a Portlet Bridge fits and whether it is the best option for supporting JSF portlets in Web Flow.
This ticket aims to explore support for JSF portlets within Web Flow with the specific goal of demonstrating that support through the swf-booking-portlet-faces sample.
Affects: 2.1.1
The text was updated successfully, but these errors were encountered: