[
https://issues.apache.org/jira/browse/TRINIDAD-2067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13009293#comment-13009293
]
Blake Sullivan commented on TRINIDAD-2067:
------------------------------------------
resolved in 2.0.beta3 in revision 1083899
> setUpEncodingContext called twice on all partial page rendered roots during
> optimized PPR
> -----------------------------------------------------------------------------------------
>
> Key: TRINIDAD-2067
> URL: https://issues.apache.org/jira/browse/TRINIDAD-2067
> Project: MyFaces Trinidad
> Issue Type: Bug
> Components: Archetype
> Affects Versions: 2.0.0-beta-3
> Reporter: Blake Sullivan
> Assignee: Blake Sullivan
> Fix For: 2.0.0-beta-3
>
> Attachments: trin2067_2B3.patch
>
> Original Estimate: 24h
> Remaining Estimate: 24h
>
> setUpEncodingContext is called on all of the partial page roots during
> optimized partial page rendering. This is because optimizedPPR uses a tree
> visit to visit the partial page roots to render and the tree visiting code
> calls setUpEncodingContext before calling the visit callback. The optimized
> PPR code then calls encodeAll() on the partial target, which calls
> beforeEncode(), which calls setupEncodingContext again. This breaks code
> that can't have its setupEncodingContext (and tearDownEncodingContext) called
> twice in a row. A good example is a form renderer that uses
> setupEncodingContext to catch cases where forms have been nested.
> The fix is to add an api to UIXComponent:
> /**
> * Calls the VisitCallback after popping the encoding or visiting context
> of the
> * current component and then restores that context, returning the
> VisitCallbacks's
> * response. This handles the rare cases where a VisitCallback should not
> be
> * called inside the target component's callback.
> * @param visitContext the <code>VisitContext</code> for this visit
> * @param component the <code>UIComponent</code> to pop the context of
> * @param callback the <code>VisitCallback</code> instance to call in the
> popped context
> * @return the result of the VisitCallback
> */
> public static VisitResult visitOutsideOfContext(
> VisitContext visitContext,
> UIComponent component,
> VisitCallback callback)
> The optimized PPR code can then wrap its current VisitCallback in one that
> calls visitOutsideOfContext, passing in the original VisitCallback.
> Other solutions would attempt to change the optimized PPR code to attempt to
> avoid calling encodeAll when the target was a UIXComponent, however doing so
> would require making assumptions about how different components have
> implemented encodeAll(), violating its abstraction.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira