You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by mf...@apache.org on 2010/06/17 19:43:44 UTC

svn commit: r955685 - /myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java

Author: mfreedman
Date: Thu Jun 17 17:43:44 2010
New Revision: 955685

URL: http://svn.apache.org/viewvc?rev=955685&view=rev
Log:
PORTLETBRIDGE-150: ViewHandler render should save/restore current ExternalContext response before delegating

Modified:
    myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java

Modified: myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java?rev=955685&r1=955684&r2=955685&view=diff
==============================================================================
--- myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java (original)
+++ myfaces/portlet-bridge/core/trunk/impl/src/main/java/org/apache/myfaces/portlet/faces/application/PortletViewHandlerImpl.java Thu Jun 17 17:43:44 2010
@@ -245,6 +245,9 @@ public class PortletViewHandlerImpl exte
       super.renderView(context, viewToRender);
       return;
     }
+    
+    ExternalContext extContext = context.getExternalContext();
+    RenderResponse renderResponse = (RenderResponse) extContext.getResponse();
 
     // If first time -- Get the renderPolicy from the context init parameter 
     if (mRenderPolicy == null)
@@ -276,7 +279,13 @@ public class PortletViewHandlerImpl exte
       catch (Throwable t)
       {
         // catch all throws and swallow -- falling through to our own
-        // render
+        // render -- Note because delegate may have set the Response object and
+        // not cleaned it up on the exception -- reset to ensure a good object
+        if (!renderResponse.equals(extContext.getResponse()))
+        {
+          extContext.setResponse(renderResponse);
+        }
+        
       }
     }
 
@@ -287,9 +296,6 @@ public class PortletViewHandlerImpl exte
       return;
     }
 
-    ExternalContext extContext = context.getExternalContext();
-    RenderResponse renderResponse = (RenderResponse) extContext.getResponse();
-
     try
     {