You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2009/09/11 11:25:09 UTC

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

Author: bommel
Date: Fri Sep 11 09:25:07 2009
New Revision: 813737

URL: http://svn.apache.org/viewvc?rev=813737&view=rev
Log:
(TOBAGO-794) FacesContext.release should called in NonFacesRequestServlet

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=813737&r1=813736&r2=813737&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 Fri Sep 11 09:25:07 2009
@@ -52,29 +52,32 @@
     FacesContextFactory fcFactory = (FacesContextFactory)
         FactoryFinder.getFactory(FactoryFinder.FACES_CONTEXT_FACTORY);
     FacesContext facesContext =
-        fcFactory.getFacesContext(getServletContext(), request, response,
-            lifecycle);
-    Application application = facesContext.getApplication();
-    ViewHandler viewHandler = application.getViewHandler();
-    String viewId = getFromViewId();
-    UIViewRoot view = viewHandler.createView(facesContext, viewId);
-    facesContext.setViewRoot(view);
+        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);
 
 //    ExternalContext externalContext = facesContext.getExternalContext();
 //    externalContext.getRequestMap().put("com.sun.faces.INVOCATION_PATH", "/faces");
 
-    // invoke application
-    String outcome = invokeApplication(facesContext);
+      // invoke application
+      String outcome = invokeApplication(facesContext);
 
-    if (facesContext.getResponseComplete()) {
-      return;
+      if (facesContext.getResponseComplete()) {
+        return;
+      }
+      if (LOG.isDebugEnabled()) {
+        LOG.debug("outcome = '" + outcome + "'");
+      }
+      NavigationHandler navigationHandler = application.getNavigationHandler();
+      navigationHandler.handleNavigation(facesContext, null, outcome);
+      lifecycle.render(facesContext);
+    } finally {
+      facesContext.release();
     }
-    if (LOG.isDebugEnabled()) {
-      LOG.debug("outcome = '" + outcome + "'");
-    }
-    NavigationHandler navigationHandler = application.getNavigationHandler();
-    navigationHandler.handleNavigation(facesContext, null, outcome);
-    lifecycle.render(facesContext);
   }
 
   public abstract String invokeApplication(FacesContext facesContext);