myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r1099890 - /myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
Date Thu, 05 May 2011 17:39:21 GMT
Author: bommel
Date: Thu May  5 17:39:20 2011
New Revision: 1099890

URL: http://svn.apache.org/viewvc?rev=1099890&view=rev
Log:
(TOBAGO-996) NonFacesRequestServlet doesn't work proper with JSF 1.2

Modified:
    myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java

Modified: myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java?rev=1099890&r1=1099889&r2=1099890&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
(original)
+++ myfaces/tobago/branches/tobago-1.0.x/core/src/main/java/org/apache/myfaces/tobago/servlet/NonFacesRequestServlet.java
Thu May  5 17:39:20 2011
@@ -41,27 +41,14 @@ public abstract class NonFacesRequestSer
 
   private static final Log LOG = LogFactory.getLog(NonFacesRequestServlet.class);
 
-  protected void service(HttpServletRequest request,
-      HttpServletResponse response) throws ServletException,
-      IOException {
-
-    LifecycleFactory lFactory = (LifecycleFactory)
-        FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
-    Lifecycle lifecycle =
-        lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
-    FacesContextFactory fcFactory = (FacesContextFactory)
-        FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
-    FacesContext facesContext =
-        fcFactory.getFacesContext(getServletContext(), request, response, lifecycle);
-    try {
-      Application application = facesContext.getApplication();
-      ViewHandler viewHandler = application.getViewHandler();
-      String viewId = getFromViewId();
-      UIViewRoot view = viewHandler.createView(facesContext, viewId);
-      facesContext.setViewRoot(view);
+  protected void service(HttpServletRequest request, HttpServletResponse response)
+      throws ServletException, IOException {
 
-//    ExternalContext externalContext = facesContext.getExternalContext();
-//    externalContext.getRequestMap().put("com.sun.faces.INVOCATION_PATH", "/faces");
+    LifecycleFactory lFactory = (LifecycleFactory) FactoryFinder.getFactory(FactoryFinder.LIFECYCLE_FACTORY);
+    Lifecycle lifecycle = lFactory.getLifecycle(LifecycleFactory.DEFAULT_LIFECYCLE);
+    FacesContextFactory fcFactory = (FacesContextFactory) FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
+    FacesContext facesContext = fcFactory.getFacesContext(getServletContext(), request, response,
lifecycle);
+    try {
 
       // invoke application
       String outcome = invokeApplication(facesContext);
@@ -72,8 +59,17 @@ public abstract class NonFacesRequestSer
       if (LOG.isDebugEnabled()) {
         LOG.debug("outcome = '" + outcome + "'");
       }
+      Application application = facesContext.getApplication();
       NavigationHandler navigationHandler = application.getNavigationHandler();
       navigationHandler.handleNavigation(facesContext, null, outcome);
+
+      if (facesContext.getViewRoot() == null) {
+        ViewHandler viewHandler = application.getViewHandler();
+        String viewId = getFromViewId();
+        UIViewRoot view = viewHandler.createView(facesContext, viewId);
+        facesContext.setViewRoot(view);
+      }
+
       lifecycle.render(facesContext);
     } finally {
       facesContext.release();
@@ -83,7 +79,7 @@ public abstract class NonFacesRequestSer
   public abstract String invokeApplication(FacesContext facesContext);
 
   /**
-   * will be called to initilize the first ViewRoot,
+   * will be called to initialize the first ViewRoot,
    * may be overwritten by extended classes
    */
   public String getFromViewId() {



Mime
View raw message