myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r1180627 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java
Date Sun, 09 Oct 2011 14:51:48 GMT
Author: lofwyr
Date: Sun Oct  9 14:51:48 2011
New Revision: 1180627

URL: http://svn.apache.org/viewvc?rev=1180627&view=rev
Log:
TOBAGO-1037: Problem with viewId=null in case of JSF 2.0 with Facelets

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java?rev=1180627&r1=1180626&r2=1180627&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/lifecycle/RenderResponseExecutor.java
Sun Oct  9 14:51:48 2011
@@ -20,8 +20,10 @@ package org.apache.myfaces.tobago.intern
 import javax.faces.FacesException;
 import javax.faces.application.Application;
 import javax.faces.application.ViewHandler;
+import javax.faces.component.UIViewRoot;
 import javax.faces.context.FacesContext;
 import javax.faces.event.PhaseId;
+import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 
 /**
@@ -36,7 +38,17 @@ class RenderResponseExecutor implements 
     ViewHandler viewHandler = application.getViewHandler();
 
     try {
-      viewHandler.renderView(facesContext, facesContext.getViewRoot());
+      final UIViewRoot viewRoot = facesContext.getViewRoot();
+      if (viewRoot.getViewId() != null) {
+        viewHandler.renderView(facesContext, viewRoot);
+      } else {
+        Object respObj = facesContext.getExternalContext().getResponse();
+        if (respObj instanceof HttpServletResponse) {
+            HttpServletResponse respHttp = (HttpServletResponse) respObj;
+            respHttp.sendError(HttpServletResponse.SC_NOT_FOUND);
+            facesContext.responseComplete();
+        }
+      }
     } catch (IOException e) {
       throw new FacesException(e.getMessage(), e);
     }



Mime
View raw message