javaserverfaces
  1. javaserverfaces
  2. JAVASERVERFACES-3151

PartialViewContextImpl doesn't leverage VisitContextFactory for PartialVisitContext so it disallows to use VisitContextWrappers

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.5
    • Fix Version/s: 2.2.6
    • Component/s: context
    • Labels:
      None

      Description

      There is a following invocation in #processPartial method:

      com.sun.faces.context.PartialViewContextImpl:398
      PartialVisitContext visitContext = new PartialVisitContext(context, phaseClientIds, hints);
      PhaseAwareVisitCallback visitCallback = new PhaseAwareVisitCallback(ctx, phaseId);
      component.visitTree(visitContext, visitCallback);
      

      PartialVisitContext is instantiated directly here instead of leveraging VisitContextFactory.

      This basically disallows use of VisitContextWrapper as a way of enriching tree traversal performed by PartialViewContext's.


      In RichFaces we could replace ExtendedPartialViewContext concept by VisitContext wrapper with same functionality, leveraging Mojarra PVCImpl. This can lower the number component-library inter-operability issues and make partial view rendering less error-prone for developers.


      Note: MyFaces leverages VisitContextFactory correctly:

      org.apache.myfaces.context.servlet.PartialViewContextImpl:418
      VisitContext visitCtx = getVisitContextFactory().getVisitContext(_facesContext, executeIds, PARTIAL_EXECUTE_HINTS);
      viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
      

        Activity

        Hide
        lfryc added a comment -
        Show
        lfryc added a comment - Link to MyFaces impl: http://svn.apache.org/repos/asf/myfaces/core/tags/myfaces-core-module-2.2.0/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java I wonder, is there any reason why Mojarra doesn't leverage VisitContextFactory ?
        Hide
        Ed Burns added a comment -

        Nice, Thanks Manfred and Lukas. I hope you are well. Are you coming to JavaLand?

        r=edburns.

        Show
        Ed Burns added a comment - Nice, Thanks Manfred and Lukas. I hope you are well. Are you coming to JavaLand? r=edburns.
        Hide
        Manfred Riem added a comment -

        Applied to 2.2 branch,

        svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3151, r=edburns, make sure PartialViewContext can be wrapped"
        Sending jsf-ri/src/main/java/com/sun/faces/context/PartialViewContextImpl.java
        Transmitting file data .
        Committed revision 12781.

        Show
        Manfred Riem added a comment - Applied to 2.2 branch, svn commit -m "Fixes https://java.net/jira/browse/JAVASERVERFACES-3151 , r=edburns, make sure PartialViewContext can be wrapped" Sending jsf-ri/src/main/java/com/sun/faces/context/PartialViewContextImpl.java Transmitting file data . Committed revision 12781.
        Hide
        Manfred Riem added a comment -

        Thanks Lukas!

        Show
        Manfred Riem added a comment - Thanks Lukas!
        Hide
        lfryc added a comment -

        Hey Manfred, Ed,
        thanks for prompt feedback and the fix!

        Show
        lfryc added a comment - Hey Manfred, Ed, thanks for prompt feedback and the fix!
        Hide
        bleathem added a comment -

        Thanks guys!

        Does it make sense to apply this fix to the 2.1 branch as well?

        Show
        bleathem added a comment - Thanks guys! Does it make sense to apply this fix to the 2.1 branch as well?
        Hide
        lfryc added a comment -

        Hi Manfred,

        I get ClassCastException with the fix before when custom VisitContextFactory is used.

        I have created a new issue to address that:
        https://java.net/jira/browse/JAVASERVERFACES-3156

        Show
        lfryc added a comment - Hi Manfred, I get ClassCastException with the fix before when custom VisitContextFactory is used. I have created a new issue to address that: https://java.net/jira/browse/JAVASERVERFACES-3156
        Hide
        Manfred Riem added a comment -

        If a back port to 2.1 is needed please file a task requesting a back port. Thanks!

        Show
        Manfred Riem added a comment - If a back port to 2.1 is needed please file a task requesting a back port. Thanks!
        Hide
        bleathem added a comment -

        I've created JAVASERVERFACES-3157 to address back-porting this fix to JSF 2.1.

        Show
        bleathem added a comment - I've created JAVASERVERFACES-3157 to address back-porting this fix to JSF 2.1.

          People

          • Assignee:
            Manfred Riem
            Reporter:
            lfryc
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: