You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2010/06/29 02:06:09 UTC
svn commit: r958793 -
/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
Author: lu4242
Date: Tue Jun 29 00:06:09 2010
New Revision: 958793
URL: http://svn.apache.org/viewvc?rev=958793&view=rev
Log:
MYFACES-2761 PartialViewContextImpl does not respect isRenderAll()
Modified:
myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java?rev=958793&r1=958792&r2=958793&view=diff
==============================================================================
--- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java (original)
+++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/context/servlet/PartialViewContextImpl.java Tue Jun 29 00:06:09 2010
@@ -239,7 +239,7 @@ public class PartialViewContextImpl exte
if (PartialViewContext.ALL_PARTIAL_PHASE_CLIENT_IDS.equals (renderMode))
{
- _renderClientIds.add ("javax.faces.ViewRoot");
+ _renderClientIds.add (PartialResponseWriter.RENDER_ALL_MARKER);
}
}
}
@@ -325,7 +325,7 @@ public class PartialViewContextImpl exte
{
//TODO process partial rendering
//https://issues.apache.org/jira/browse/MYFACES-2118
- Collection<String> renderIds = getRenderIds();
+ //Collection<String> renderIds = getRenderIds();
// We need to always update the view state marker when processing partial
// rendering, because there is no way to check when the state has been changed
@@ -356,33 +356,30 @@ public class PartialViewContextImpl exte
inDocument = true;
_facesContext.setResponseWriter(writer);
- //Only apply partial visit if we have ids to traverse
- if (renderIds != null && !renderIds.isEmpty())
+ if (isRenderAll())
{
- Set<VisitHint> hints = new HashSet<VisitHint>();
- // unrendered have to be skipped, transient definitely must be added to our list!
- hints.add(VisitHint.SKIP_UNRENDERED);
-
- // render=@all, so output the body.
- if (renderIds.contains ("javax.faces.ViewRoot"))
+ processRenderAll(viewRoot, writer);
+ }
+ else
+ {
+ Collection<String> renderIds = getRenderIds();
+ //Only apply partial visit if we have ids to traverse
+ if (renderIds != null && !renderIds.isEmpty())
{
- java.util.Iterator<UIComponent> iter = viewRoot.getFacetsAndChildren();
- writer.startUpdate ("javax.faces.ViewRoot");
- while (iter.hasNext())
- {
- UIComponent comp = iter.next();
-
- if (comp instanceof javax.faces.component.html.HtmlBody)
- {
- comp.encodeAll (_facesContext);
- }
+ Set<VisitHint> hints = new HashSet<VisitHint>();
+ // unrendered have to be skipped, transient definitely must be added to our list!
+ hints.add(VisitHint.SKIP_UNRENDERED);
+
+ // render=@all, so output the body.
+ if (renderIds.contains (PartialResponseWriter.RENDER_ALL_MARKER))
+ {
+ processRenderAll(viewRoot, writer);
+ }
+ else
+ {
+ VisitContext visitCtx = VisitContext.createVisitContext(_facesContext, renderIds, hints);
+ viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
}
- writer.endUpdate();
- }
- else
- {
- VisitContext visitCtx = VisitContext.createVisitContext(_facesContext, renderIds, hints);
- viewRoot.visitTree(visitCtx, new PhaseAwareVisitCallback(_facesContext, phaseId));
}
}
@@ -430,6 +427,24 @@ public class PartialViewContextImpl exte
}
}
+
+ private void processRenderAll(UIViewRoot viewRoot, PartialResponseWriter writer) throws IOException
+ {
+ java.util.Iterator<UIComponent> iter = viewRoot.getFacetsAndChildren();
+ writer.startUpdate (PartialResponseWriter.RENDER_ALL_MARKER);
+ while (iter.hasNext())
+ {
+ UIComponent comp = iter.next();
+
+ //TODO: Do not check for a specific instance,
+ //just render all children.
+ if (comp instanceof javax.faces.component.html.HtmlBody)
+ {
+ comp.encodeAll (_facesContext);
+ }
+ }
+ writer.endUpdate();
+ }
/**
* has to be thrown in many of the methods if the method is called after the instance has been released!