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

Provide support for Portlet API 2.0 and JSF 1.2

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Complete
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.2.0.RC1
    • Component/s: Integration: Portlet, JSF
    • Labels:
      None

      Description

      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.

        Activity

        Hide
        Mindaugas Plukas added a comment -

        Thanks for reply.

        After taking a brief look into the code I was not sure what controller AJAX requests will go to.
        AJAX requests can not be portlet action requests (since these are processes by the portal and delivers a whole page) but it seemed that all JSF action URLs will be formed as portlet action URLs.
        Theoretically, in portal environment AJAX requests could be portlet resource requests or servlet requests. In former case it is not clear how RichFaces support, for example, org.ajax4jsf.Filter or org.springframework.faces.richfaces.RichFacesAjaxHandler should be configured? In latter case should application provide DispatcherServlet and FlowController (operating on the same flow executor as org.springframework.webflow.mvc.portlet.FlowHandlerAdapter)?

        Very likely that I missed something. Could you please elaborate this point a little. Thank you.

        Show
        Mindaugas Plukas added a comment - Thanks for reply. After taking a brief look into the code I was not sure what controller AJAX requests will go to. AJAX requests can not be portlet action requests (since these are processes by the portal and delivers a whole page) but it seemed that all JSF action URLs will be formed as portlet action URLs. Theoretically, in portal environment AJAX requests could be portlet resource requests or servlet requests. In former case it is not clear how RichFaces support, for example, org.ajax4jsf.Filter or org.springframework.faces.richfaces.RichFacesAjaxHandler should be configured? In latter case should application provide DispatcherServlet and FlowController (operating on the same flow executor as org.springframework.webflow.mvc.portlet.FlowHandlerAdapter)? Very likely that I missed something. Could you please elaborate this point a little. Thank you.
        Hide
        Rossen Stoyanchev added a comment -

        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) {
        PortletRequestDispatcher rd = this.getPortletContext().getRequestDispatcher(request.getResourceID());
        if (rd != null)

        { rd.forward(request, response); }

        }

        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.

        Show
        Rossen Stoyanchev added a comment - 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) { PortletRequestDispatcher rd = this.getPortletContext().getRequestDispatcher(request.getResourceID()); if (rd != null) { rd.forward(request, response); } } 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.
        Hide
        Mindaugas Plukas added a comment -

        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:
        1.org.springframework.webflow.context.portlet.FlowUrlHandler abstraction should be extended with
        method createFlowExecutionResourceUrl() (in addition to createFlowExecutionUrl()). This method would
        produce portlet resource URL.
        2.Ensure that SWF provided faces ViewHandler (e.g. PortletFaceletViewHandler) effectively use createFlowExecutionResourceUrl()
        for rendering JSF AJAX URLs.
        3.org.springframework.webflow.mvc.portlet.FlowHandlerAdapter should handle portlet resource request in the same way as action requests.
        4.Maybe portlet enviromnet needs AjaxHandler abstraction and logic based on it, as has servlet environment; then it should be added
        to org.springframework.webflow.mvc.portlet.FlowHandlerAdapter and related classes.

        Concerning RichFaces support
        1.Open question how configure org.ajax4jsf.Filter for DispatcherPortlet. (Maybe port/adapt it to portlet filter?)
        2.RichFacesAjaxHandler for portlet environment maybe needed (see above).

        By the way , JSF portlet with RichFaces and JBoss portlet bridge employs portlet resource URLs for <a4j> requests.
        Also in that setup bridge portlet delegates to FacesServlet, and org.ajax4jsf.Filter is mapped on that servlet.

        Show
        Mindaugas Plukas added a comment - 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: 1.org.springframework.webflow.context.portlet.FlowUrlHandler abstraction should be extended with method createFlowExecutionResourceUrl() (in addition to createFlowExecutionUrl()). This method would produce portlet resource URL. 2.Ensure that SWF provided faces ViewHandler (e.g. PortletFaceletViewHandler) effectively use createFlowExecutionResourceUrl() for rendering JSF AJAX URLs. 3.org.springframework.webflow.mvc.portlet.FlowHandlerAdapter should handle portlet resource request in the same way as action requests. 4.Maybe portlet enviromnet needs AjaxHandler abstraction and logic based on it, as has servlet environment; then it should be added to org.springframework.webflow.mvc.portlet.FlowHandlerAdapter and related classes. Concerning RichFaces support 1.Open question how configure org.ajax4jsf.Filter for DispatcherPortlet. (Maybe port/adapt it to portlet filter?) 2.RichFacesAjaxHandler for portlet environment maybe needed (see above). By the way , JSF portlet with RichFaces and JBoss portlet bridge employs portlet resource URLs for <a4j> requests. Also in that setup bridge portlet delegates to FacesServlet, and org.ajax4jsf.Filter is mapped on that servlet.
        Hide
        Rossen Stoyanchev added a comment -

        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.

        Show
        Rossen Stoyanchev added a comment - 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.
        Hide
        Rossen Stoyanchev added a comment -

        I've added SWF-1415 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 SWF-1415 is certainly needed regardless of that.

        Show
        Rossen Stoyanchev added a comment - I've added SWF-1415 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 SWF-1415 is certainly needed regardless of that.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development