You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ms...@apache.org on 2010/03/30 19:56:03 UTC
svn commit: r929205 -
/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java
Author: mstarets
Date: Tue Mar 30 17:56:03 2010
New Revision: 929205
URL: http://svn.apache.org/viewvc?rev=929205&view=rev
Log:
Fixed the problem with creating a PartialResponseWriter when the ViewRoot is null
Modified:
myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java
Modified: myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java?rev=929205&r1=929204&r2=929205&view=diff
==============================================================================
--- myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java (original)
+++ myfaces/trinidad/branches/jsf2_ajax.3/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/context/PartialViewContextImpl.java Tue Mar 30 17:56:03 2010
@@ -20,6 +20,7 @@ package org.apache.myfaces.trinidadinter
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.util.Collection;
@@ -49,10 +50,13 @@ import javax.faces.component.visit.Visit
import javax.faces.component.visit.VisitHint;
import javax.faces.component.visit.VisitResult;
+import javax.faces.render.RenderKit;
+
import org.apache.myfaces.trinidad.component.visit.VisitTreeUtils;
import org.apache.myfaces.trinidad.context.PartialPageContext;
import org.apache.myfaces.trinidad.context.RenderingContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
+import org.apache.myfaces.trinidadinternal.io.XhtmlResponseWriter;
import org.apache.myfaces.trinidadinternal.renderkit.core.ppr.PPRResponseWriter;
import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.PartialPageUtils;
import org.apache.myfaces.trinidadinternal.renderkit.core.CoreRenderKit;
@@ -197,20 +201,13 @@ public class PartialViewContextImpl
return (PartialResponseWriter)current;
}
- if (_context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE)
- {
- _LOG.warning("getPartialResponseWriter() called during render_reponse. " +
- "The returned writer is not integrated with PPRResponseWriter");
- ResponseWriter rw = _context.getResponseWriter();
-
- return new PartialResponseWriter(rw);
- }
-
- // Create PartialResponseWriter for sending errors, redirects, etc. outside
- // of the render phase
-
if (current != null)
{
+ if (_context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE)
+ {
+ _LOG.warning("getPartialResponseWriter() called during render_reponse. " +
+ "The returned writer is not integrated with PPRResponseWriter");
+ }
return new PartialResponseWriter(current);
}
@@ -229,9 +226,24 @@ public class PartialViewContextImpl
if (out != null)
{
- ResponseWriter responseWriter =
- _context.getRenderKit().createResponseWriter(out, "text/xml",
- encoding);
+ ResponseWriter responseWriter = null;
+ RenderKit kit = _context.getRenderKit();
+ if (kit != null)
+ {
+ responseWriter = kit.createResponseWriter(out, "text/xml", encoding);
+ }
+ else
+ {
+ try
+ {
+ responseWriter = new XhtmlResponseWriter(out, "text/xml", encoding);
+ }
+ catch(UnsupportedEncodingException e)
+ {
+ _LOG.severe(e);
+ }
+ }
+
return new PartialResponseWriter(responseWriter);
}