Uploaded image for project: 'Portlet Bridge'
  1. Portlet Bridge
  2. PBR-176

Images cannot be rendered after an ajax re-render in portal environment

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.0.0.CR1
    • Fix Version/s: 2.1.0.CR1
    • Component/s: JSF, RichFaces
    • Labels:
      None
    • Environment:

      Windows XP, Tomcat 6.0.18, JetSpeed Portal 2.2.1, JRE 1.6.0_11, RichFaces 3.3.3.BETA1, JSF - MyFaces 1.2.8

      Description

      I'm testing richfaces components and portlet bridge on JetSpeed portal 2.2.1. I've created a portlet web application and almost everything seems to be working except for images. I have a portlet that has some richfaces components. When the portal page first renders, images for every richfaces component renders as expected. But when I do something that will trigger a re-render of some component that uses an image (for instance rich:tree) richfaces component renders normally but the images disappear.

      I debugged the sources and figured out the problem is in org.jboss.portletbridge.AjaxPortletBridge class. For each image in the richfaces component (node icons for a tree for instance)

      public void doFacesRequest(ResourceRequest request, ResourceResponse response)

      method is invoked for the image. For the page's first render, the code forwards the image request to the dispatcher and images render normally. But for a re-render request triggerred by ajax, request has a parameter named Bridge.FACES_VIEW_ID_PARAMETER set to the portlet's view id. Since this parameter is not null, in this case bridge implementation assumes that the request for the image is a JSF request and tries to execute JSF lifecycle. Since the request is not actually a jsf render request, image is not rendered.

      I fixed this behaviour by overriding AjaxPortletBridge class. Simply adding the condition (request.getResourceID() != null && !request.getResourceID().endsWith(".jsf")) to the if condition

      if (null == request.getParameter(Bridge.FACES_VIEW_ID_PARAMETER) && null == request.getParameter(Bridge.FACES_VIEW_PATH_PARAMETER))

      prevents the bridge class to execute JSF lifecycle for image requests. When the condition becomes:

      if ((null == request.getParameter(Bridge.FACES_VIEW_ID_PARAMETER) && null == request.getParameter(Bridge.FACES_VIEW_PATH_PARAMETER)) || (request.getResourceID() != null && !request.getResourceID().endsWith(".jsf")))

      Non-jsf resource requests (where ResourceID is bla_bla.gif) will be forwarded to the dispatcher.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                wesleyhales Wesley Hales
                Reporter:
                ayzegul Aysegul Aydin Isiktekin
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: