You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/06/07 06:49:50 UTC

svn commit: r188692 - in /incubator/beehive/trunk/netui: src/pageflow/org/apache/beehive/netui/pageflow/ src/pageflow/org/apache/beehive/netui/pageflow/handler/ src/pageflow/org/apache/beehive/netui/pageflow/internal/ src/util/schema/netui-config/ test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/ test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/ test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/ test/webapps/drt/testRecorder/config/ test/webapps/drt/testRecorder/tests/

Author: rich
Date: Mon Jun  6 21:49:48 2005
New Revision: 188692

URL: http://svn.apache.org/viewcvs?rev=188692&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-756 : Major badness when moving between page flows in the same request, with multiple concurrent requests

tests: bvt in netui (WinXP)
BB: self (linux)


Added:
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java   (contents, props changed)
      - copied, changed from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/
      - copied from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/
      - copied from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/
      - copied from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml   (props changed)
      - copied unchanged from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml
Modified:
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModuleFactory.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/FacesBackingBeanFactory.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
    incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
    incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java Mon Jun  6 21:49:48 2005
@@ -622,6 +622,12 @@
             }
             else
             {
+                //
+                // Initialize the ServletContext in the request.  Often, we need access to the ServletContext when we only
+                // have a ServletRequest.
+                //
+                InternalUtils.setServletContext( request, getServletContext() );
+                
                 if ( processUnhandledAction( request, response, servletPath ) ) return;
                 
                 String originalServletPath = requestWrapper.getOriginalServletPath();

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java Mon Jun  6 21:49:48 2005
@@ -23,6 +23,8 @@
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.CachedSharedFlowRefInfo;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
 import org.apache.beehive.netui.util.internal.cache.ClassLevelCache;
 import org.apache.beehive.netui.util.logging.Logger;
 
@@ -62,8 +64,13 @@
      */ 
     public void persistInSession( HttpServletRequest request, HttpServletResponse response )
     {
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
-        ScopedServletUtils.setScopedSessionAttr( InternalConstants.FACES_BACKING_ATTR, this, unwrappedRequest );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName =
+                ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
+        
+        sh.setAttribute( rc, attrName, this );
     }
 
     /**
@@ -71,8 +78,13 @@
      */ 
     protected void removeFromSession( HttpServletRequest request )
     {
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
-        ScopedServletUtils.removeScopedSessionAttr( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName =
+                ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
+        
+        sh.removeAttribute( rc, attrName );
     }
 
     /**
@@ -85,11 +97,13 @@
      */ 
     public void ensureFailover( HttpServletRequest request )
     {
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
         String attr =
                 ScopedServletUtils.getScopedSessionAttrName( InternalConstants.FACES_BACKING_ATTR, unwrappedRequest );
-        ServletContext servletContext = InternalUtils.getServletContext( request );
-        AdapterManager.getServletContainerAdapter( servletContext ).ensureFailover( attr, this, unwrappedRequest );
+        sh.ensureFailover( rc, attr, this );
     }
 
     /**

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java Mon Jun  6 21:49:48 2005
@@ -554,7 +554,7 @@
         
         //
         // We may have lost our transient ServletContext reference.  Try to get the ServletContext reference from the
-        // HttpSession object.
+        // HttpSession object if necessary.
         //
         ServletContext servletContext = getServletContext();
         if ( servletContext == null && session != null ) servletContext = session.getServletContext();

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java Mon Jun  6 21:49:48 2005
@@ -44,6 +44,8 @@
 import org.apache.beehive.netui.pageflow.internal.ViewRenderer;
 import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
 
 
 /**
@@ -192,7 +194,7 @@
         }
         else
         {
-            InternalUtils.removeCurrentPageFlow( request );
+            InternalUtils.removeCurrentPageFlow( request, getServletContext() );
         }
     }
     
@@ -222,12 +224,12 @@
             //
             synchronized ( currentPageFlow )
             {
-                InternalUtils.setCurrentPageFlow( this, request );
+                InternalUtils.setCurrentPageFlow( this, request, getServletContext() );
             }
         }
         else
         {
-            InternalUtils.setCurrentPageFlow( this, request );
+            InternalUtils.setCurrentPageFlow( this, request, getServletContext() );
         }
     }
 
@@ -248,8 +250,9 @@
         //
         if ( request.getAttribute( REMOVING_PAGEFLOW_ATTR ) != this && request.getSession( false ) != null )
         {
+            StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
             HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
-            ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( getServletContext() );
+            RequestContext rc = new RequestContext( unwrappedRequest, null );
         
             //
             // If this is a long-lived page flow, there are two attributes to deal with.
@@ -260,13 +263,13 @@
                 longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest );
                 String currentLongLivedAttrName =
                     ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
-                servletContainerAdapter.ensureFailover( longLivedAttrName, this, unwrappedRequest );
-                servletContainerAdapter.ensureFailover( currentLongLivedAttrName, getModulePath(), unwrappedRequest );
+                sh.ensureFailover( rc, longLivedAttrName, this );
+                sh.ensureFailover( rc, currentLongLivedAttrName, getModulePath() );
             }
             else
             {
                 String attrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
-                servletContainerAdapter.ensureFailover( attrName, this, unwrappedRequest );
+                sh.ensureFailover( rc, attrName, this );
             } 
         }
     }
@@ -880,7 +883,7 @@
         //
         if ( ! _isOnNestingStack )
         {
-            destroy( event.getSession() );
+            super.valueUnbound( event );
         }
     }
     

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java Mon Jun  6 21:49:48 2005
@@ -18,6 +18,7 @@
 package org.apache.beehive.netui.pageflow;
 
 import org.apache.beehive.netui.pageflow.internal.JavaControlUtils;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
 import org.apache.beehive.netui.util.logging.Logger;
 
 import javax.servlet.http.HttpSessionBindingListener;
@@ -41,7 +42,7 @@
      * Reference to the current ServletContext.
      */ 
     private transient ServletContext _servletContext;
-
+    
     
     /**
      * Reinitialize the object for a new request.  Used by the framework; normally should not be called directly.
@@ -87,7 +88,7 @@
      */ 
     protected void onDestroy( HttpSession session )
     {
-    } 
+    }
     
     /**
      * Callback when this object is added to the user session.
@@ -102,9 +103,27 @@
      */ 
     public void valueUnbound( HttpSessionBindingEvent event )
     {
-        destroy( event.getSession() );
+        //
+        // We may have lost our transient ServletContext reference.  Try to get the ServletContext reference from the
+        // HttpSession object if necessary.
+        //
+        ServletContext servletContext = getServletContext();
+        HttpSession session = event.getSession();
+        
+        if ( servletContext == null && session != null )
+        {
+            servletContext = session.getServletContext();
+        }
+        
+        if ( servletContext != null )
+        {
+            if ( Handlers.get( servletContext ).getStorageHandler().allowBindingEvent( event ) )
+            {
+                destroy( session );
+            }
+        }
     }
-
+    
     /**
      * Remove this instance from the session.
      */ 

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java Mon Jun  6 21:49:48 2005
@@ -49,6 +49,7 @@
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
+import org.apache.beehive.netui.pageflow.internal.DeferredSessionStorageHandler;
 import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
 
 
@@ -164,6 +165,9 @@
             //
             URLRewriterService.registerURLRewriter( 0, request, new DefaultURLRewriter() );
 
+            PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap( request );
+            boolean isForwardedRequest = rw != null && rw.isForwardedRequest();
+            
             try
             {
                 ModuleConfig prevModuleConfig = RequestUtils.getRequestModuleConfig( httpRequest );
@@ -230,6 +234,15 @@
                 _servletContainerAdapter.endRequest( httpRequest, httpResponse );
                 long timeTaken = System.currentTimeMillis() - startTime;
                 er.endPageRequest( requestContext, timeTaken );
+                
+                //
+                // If this is not a forwarded request, then commit any session-scoped changes that were stored in the
+                // request.
+                //
+                if ( ! isForwardedRequest )
+                {
+                    DeferredSessionStorageHandler.applyChanges( httpRequest, _servletContext );
+                }
             }
         }
         else

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Mon Jun  6 21:49:48 2005
@@ -44,6 +44,7 @@
 import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.UnhandledException;
+import org.apache.beehive.netui.pageflow.internal.DeferredSessionStorageHandler;
 import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
@@ -90,15 +91,8 @@
 import java.lang.reflect.Field;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
+import java.util.*;
+
 import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
 
 
@@ -111,7 +105,7 @@
         extends TilesRequestProcessor
         implements Serializable, InternalConstants, PageFlowConstants
 {
-    private static int requestCount = 0;
+    private static int requestNumber = 0;
 
     private static final Logger _log = Logger.getInstance( PageFlowRequestProcessor.class );
     
@@ -123,7 +117,7 @@
     private static final String REDIRECT_REQUEST_ATTRS_PARAM = "forceRedirect";
     private static final String FLOW_CONTROLLER_ACTION_CLASSNAME = FlowControllerAction.class.getName();
     private static final NullActionForm NULL_ACTION_FORM = new NullActionForm();
-
+    
     
     private Map/*< String, Class >*/ _formBeanClasses = new HashMap/*< String, Class >*/();
     private Map/*< String, List< ActionMapping > >*/ _overloadedActions = new HashMap/*< String, List< ActionMapping > >*/();
@@ -386,7 +380,7 @@
             // no databinding errors when the override action does not use a form bean.
             //
             if ( form == null && requestWrapper.isForwardedByButton() ) form = NULL_ACTION_FORM;
-
+            
             ProcessPopulate.populate( request, response, form, alreadyCalledInRequest );
         }
     }
@@ -803,7 +797,7 @@
 
         if ( _log.isTraceEnabled() )
         {
-            localRequestCount = ++requestCount;
+            localRequestCount = ++requestNumber;
             _log.trace( "------------------------------- Start Request #" + localRequestCount
                        + " -----------------------------------" );
         }
@@ -863,6 +857,9 @@
         // Register the default URLRewriter
         //
         URLRewriterService.registerURLRewriter( 0, request, new DefaultURLRewriter() );
+        
+        PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap( request );
+        boolean isForwardedRequest = rw != null && rw.isForwardedRequest();
 
         try
         {
@@ -870,6 +867,15 @@
         }
         finally
         {
+            //
+            // If this is not a forwarded request, then commit any session-scoped changes that were stored in the
+            // request.
+            //
+            if ( ! isForwardedRequest )
+            {
+                DeferredSessionStorageHandler.applyChanges( request, servletContext );
+            }
+            
             //
             // Clean up the ControlBeanContext in the session.
             //

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowStack.java Mon Jun  6 21:49:48 2005
@@ -25,6 +25,8 @@
 import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
 import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor;
 import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptorContext;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
 
 import javax.servlet.http.HttpSessionBindingListener;
 import javax.servlet.http.HttpSessionBindingEvent;
@@ -113,9 +115,12 @@
      */    
     public static PageFlowStack get( HttpServletRequest request, boolean createIfNotExist )
     {
-        PageFlowStack jpfStack =
-                ( PageFlowStack ) ScopedServletUtils.getScopedSessionAttr( JPF_STACK_ATTR,
-                                                                           PageFlowUtils.unwrapMultipart( request ) );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
+        PageFlowStack jpfStack = ( PageFlowStack ) sh.getAttribute( rc, attrName );
 
         if ( jpfStack == null && createIfNotExist )
         {
@@ -133,7 +138,13 @@
      */ 
     public static void destroy( HttpServletRequest request )
     {
-        ScopedServletUtils.removeScopedSessionAttr( JPF_STACK_ATTR, PageFlowUtils.unwrapMultipart( request ) );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
+        
+        sh.removeAttribute( rc, attrName );
     }
     
     /**
@@ -161,7 +172,7 @@
                 //
                 // We're discarding the popped page flow.  Invoke its destroy() callback, unless it's longLived.
                 //
-                if ( ! popped.isLongLived() ) popped.destroy( request.getSession() );
+                if ( ! popped.isLongLived() ) popped.destroy( request.getSession( false ) );
             }
         }
 
@@ -198,14 +209,23 @@
     
     void ensureFailover( HttpServletRequest request, ServletContext servletContext )
     {
-        String name =
-            ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, PageFlowUtils.unwrapMultipart( request ) );
-        AdapterManager.getServletContainerAdapter( servletContext ).ensureFailover( name, this, request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
+        
+        sh.ensureFailover( rc, attrName, this );
     }
     
     void save( HttpServletRequest request )
     {
-        ScopedServletUtils.setScopedSessionAttr( JPF_STACK_ATTR, this, PageFlowUtils.unwrapMultipart( request ) );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
+        
+        sh.setAttribute( rc, attrName, this );
     }
     
     PageFlowStack()

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java Mon Jun  6 21:49:48 2005
@@ -31,9 +31,12 @@
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
 import org.apache.beehive.netui.pageflow.internal.URIContextFactory;
+import org.apache.beehive.netui.pageflow.internal.DeferredSessionStorageHandler;
 import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
 import org.apache.beehive.netui.pageflow.scoping.ScopedResponse;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
 import org.apache.beehive.netui.util.internal.FileUtils;
 import org.apache.beehive.netui.util.internal.ServletUtils;
 import org.apache.beehive.netui.util.config.ConfigUtil;
@@ -244,24 +247,28 @@
      */ 
     public static ActionResolver getCurrentActionResolver( HttpServletRequest request )
     {
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        
         //
         // First see if the current page flow is a long-lived, which is stored in its own attribute.
         //
-        HttpServletRequest unwrappedRequest = unwrapMultipart( request );
-        String currentLongLivedModulePath =
-                ( String ) ScopedServletUtils.getScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+        String currentLongLivedAttrName =
+                ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+        String currentLongLivedModulePath = ( String ) sh.getAttribute( rc, currentLongLivedAttrName );
         ActionResolver retVal;
         
         if ( currentLongLivedModulePath != null )
         {
-            retVal = getLongLivedPageFlow( currentLongLivedModulePath, unwrappedRequest );
+            return getLongLivedPageFlow( currentLongLivedModulePath, unwrappedRequest );
         }
         else
         {
-            retVal = ( ActionResolver ) ScopedServletUtils.getScopedSessionAttr( CURRENT_JPF_ATTR, unwrappedRequest );
+            String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
+            return ( ActionResolver ) sh.getAttribute( rc, currentJpfAttrName );
         }
-        
-        return retVal;
     }
     
     /**
@@ -302,14 +309,12 @@
      */ 
     public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request )
     {
-        HttpSession session = request.getSession( false );
-        
-        if ( session != null )
-        {
-            return ( SharedFlowController ) session.getAttribute( SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName );
-        }
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
         
-        return null;
+        return ( SharedFlowController ) sh.getAttribute( rc, SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName );
     }
     
     /**
@@ -319,8 +324,11 @@
      */ 
     public static void removeSharedFlow( String sharedFlowClassName, HttpServletRequest request )
     {
-        HttpSession session = request.getSession( false );
-        if ( session != null ) request.getSession().removeAttribute( SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        sh.removeAttribute( rc, SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName );
     }
     
     
@@ -332,19 +340,26 @@
      */
     public static void removeLongLivedPageFlow( String modulePath, HttpServletRequest request )
     {
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
         HttpServletRequest unwrappedRequest = unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        
         String attrName = InternalUtils.getLongLivedFlowAttr( modulePath );
-        ScopedServletUtils.removeScopedSessionAttr( attrName, unwrappedRequest );
+        attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest );
+        sh.removeAttribute( rc, attrName );
 
         //
         // Now, if the current page flow is long-lived, remove the reference.
         //
+        String currentLongLivedAttrName =
+                ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
         String currentLongLivedModulePath =
-                ( String ) ScopedServletUtils.getScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+                ( String ) sh.getAttribute( rc, currentLongLivedAttrName );
         
         if ( modulePath.equals( currentLongLivedModulePath ) )
         {
-            ScopedServletUtils.removeScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+            sh.removeAttribute( rc, currentLongLivedAttrName );
         }
     }
     
@@ -357,9 +372,14 @@
      */ 
     public static PageFlowController getLongLivedPageFlow( String modulePath, HttpServletRequest request )
     {
-        String attr = InternalUtils.getLongLivedFlowAttr( modulePath );
-        PageFlowController retVal =  ( PageFlowController )
-                ScopedServletUtils.getScopedSessionAttr( attr, unwrapMultipart( request ) );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        
+        String attrName = InternalUtils.getLongLivedFlowAttr( modulePath );
+        attrName = ScopedServletUtils.getScopedSessionAttrName( attrName, unwrappedRequest );
+        PageFlowController retVal =  ( PageFlowController ) sh.getAttribute( rc, attrName );
         return retVal;
     }
     
@@ -1031,6 +1051,8 @@
             returnURI = scopedResponse.getRedirectURI();
         }
         
+        DeferredSessionStorageHandler.applyChanges( scopedRequest, context );
+        
         if ( returnURI != null )
         {
             return new ActionResultImpl( returnURI, scopedResponse.didRedirect(), scopedResponse.getStatusCode(),
@@ -1258,7 +1280,8 @@
      */ 
     public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request )
     {
-        InternalUtils.setCurrentActionResolver( resolver, request );
+        ServletContext servletContext = InternalUtils.getServletContext( request ); 
+        InternalUtils.setCurrentActionResolver( resolver, request, servletContext );
     }
 
     /**

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java Mon Jun  6 21:49:48 2005
@@ -28,6 +28,10 @@
 
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
+import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 
 
 /**
@@ -114,7 +118,11 @@
      */ 
     public void persistInSession( HttpServletRequest request, HttpServletResponse response )
     {
-        request.getSession().setAttribute( InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        sh.setAttribute( rc, InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );
     }
     
     /**
@@ -127,8 +135,10 @@
      */ 
     public void ensureFailover( HttpServletRequest request )
     {
-        ServletContainerAdapter servletContainerAdapter = AdapterManager.getServletContainerAdapter( getServletContext() );
-        servletContainerAdapter.ensureFailover( InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this, request );
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        sh.ensureFailover( rc, InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );
     }
     
     /**

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModuleFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModuleFactory.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModuleFactory.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/StrutsModuleFactory.java Mon Jun  6 21:49:48 2005
@@ -27,11 +27,10 @@
  */ 
 public class StrutsModuleFactory
 {
-    public static ActionResolver getStrutsModule( String strutsModulePath,
-                                                  HttpServletRequest request )
+    public static ActionResolver getStrutsModule( String strutsModulePath, HttpServletRequest request )
     {
         ActionResolver strutsModule = new StrutsModule( strutsModulePath );
-        InternalUtils.setCurrentActionResolver( strutsModule, request );
+        InternalUtils.setCurrentActionResolver( strutsModule, request, InternalUtils.getServletContext( request ) );
         return strutsModule;
     }
 }

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java Mon Jun  6 21:49:48 2005
@@ -30,6 +30,8 @@
 import org.apache.beehive.netui.pageflow.internal.DefaultExceptionsHandler;
 import org.apache.beehive.netui.pageflow.internal.DefaultActionForwardHandler;
 import org.apache.beehive.netui.pageflow.internal.DefaultHandler;
+import org.apache.beehive.netui.pageflow.internal.SimpleSessionStorageHandler;
+import org.apache.beehive.netui.pageflow.internal.DeferredSessionStorageHandler;
 import org.apache.beehive.netui.pageflow.PageFlowActionServlet;
 import org.apache.beehive.netui.pageflow.PageFlowContextListener;
 
@@ -50,6 +52,7 @@
     private ExceptionsHandler _exceptionsHandler = null;
     private ForwardRedirectHandler _forwardRedirectHandler = null;
     private LoginHandler _loginHandler = null;
+    private StorageHandler _storageHandler = null;
     private ReloadableClassHandler _reloadableClassHandler = null;
     private transient ServletContext _servletContext;
     
@@ -99,6 +102,7 @@
         DefaultHandler defaultExceptionsHandler = new DefaultExceptionsHandler( servletContext );
         DefaultHandler defaultForwardRedirectHandler = new DefaultForwardRedirectHandler( servletContext );
         DefaultHandler defaultLoginHandler = new DefaultLoginHandler( servletContext );
+        DefaultHandler defaultStorageHandler = new DeferredSessionStorageHandler( servletContext );
         DefaultHandler defaultReloadableClassHandler = new DefaultReloadableClassHandler( servletContext );
         
         _actionForwardHandler = ( ActionForwardHandler )
@@ -117,6 +121,10 @@
                 adaptHandler( handlers != null ? handlers.getLoginHandlerArray() : null, defaultLoginHandler,
                               LoginHandler.class, servletContext );
         
+        _storageHandler = ( StorageHandler )
+                adaptHandler( handlers != null ? handlers.getStorageHandlerArray() : null, defaultStorageHandler,
+                              StorageHandler.class, servletContext );
+        
         _reloadableClassHandler = ( ReloadableClassHandler )
                 adaptHandler( handlers != null ? handlers.getReloadableClassHandlerArray() : null,
                               defaultReloadableClassHandler, ReloadableClassHandler.class, servletContext );
@@ -131,6 +139,7 @@
             _exceptionsHandler.reinit( servletContext );
             _forwardRedirectHandler.reinit( servletContext );
             _loginHandler.reinit( servletContext );
+            _storageHandler.reinit( servletContext );
             _reloadableClassHandler.reinit( servletContext );
         }
     }
@@ -153,6 +162,11 @@
     public LoginHandler getLoginHandler()
     {
         return _loginHandler;
+    }
+    
+    public StorageHandler getStorageHandler()
+    {
+        return _storageHandler;
     }
     
     public ReloadableClassHandler getReloadableClassHandler()

Copied: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java (from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java?p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java&p1=incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/StorageHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java Mon Jun  6 21:49:48 2005
@@ -480,7 +480,7 @@
             _log.debug( "Popped PageFlowController " + poppedPageFlow + " from the nesting stack" );
         }
 
-        InternalUtils.setCurrentPageFlow( poppedPageFlow, request );
+        InternalUtils.setCurrentPageFlow( poppedPageFlow, request, getServletContext() );
 
                 
         //
@@ -581,8 +581,11 @@
                 return fwd;
             }
         }
-        catch ( InterceptorException e )
+        catch ( Throwable e )
         {
+            //
+            // Yes, we *do* mean to catch Throwable here.  It will get re-thrown if the page flow does not handle it.
+            //
             _log.error( "Exception in " + interceptor.getClass().getName() + ".afterNestedIntercept", e );
             
             try
@@ -598,7 +601,9 @@
         //
         // The interceptor declined to forward us anywhere -- just go to the originally-intended Forward.
         //
-        return pushedPageFlowWrapper.getInterceptedForward();
+        InterceptorForward fwd = pushedPageFlowWrapper.getInterceptedForward();
+        fwd.rehydrateRequest( request );
+        return fwd;
     }
     
     public ActionForwardHandler getRegisteredActionForwardHandler()

Copied: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java (from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java?p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java&p1=incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
--- incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java Mon Jun  6 21:49:48 2005
@@ -87,7 +87,7 @@
         //
         if ( currentValue != null && currentValue != value && currentValue instanceof HttpSessionBindingListener )
         {
-            HttpSessionBindingEvent event = new SessionBindingEvent( request.getSession( false ), attrName, value );
+            HttpSessionBindingEvent event = new SessionBindingEvent( request.getSession( false ), attrName, currentValue );
             ( ( HttpSessionBindingListener ) currentValue ).valueUnbound( event );
         }
         
@@ -95,11 +95,23 @@
         getChangedAttributesList( request, true, false ).add( attrName );
     }
     
-    public void removeAttribute( RequestContext context, String attributeName )
+    public void removeAttribute( RequestContext context, String attrName )
     {
-        ServletRequest request = ScopedServletUtils.getOuterServletRequest( context.getRequest() );
-        request.removeAttribute( attributeName );
-        getChangedAttributesList( request, true, false ).add( attributeName );
+        HttpServletRequest request = ScopedServletUtils.getOuterRequest( ( HttpServletRequest ) context.getRequest() );
+        Object currentValue = request.getAttribute( attrName );
+        
+        //
+        // Emulate a removeAttribute on the session: if the value is an HttpSessionBindingListener, invoke its
+        // valueUnbound().
+        //
+        if ( currentValue != null && currentValue instanceof HttpSessionBindingListener )
+        {
+            HttpSessionBindingEvent event = new SessionBindingEvent( request.getSession( false ), attrName, currentValue );
+            ( ( HttpSessionBindingListener ) currentValue ).valueUnbound( event );
+        }
+        
+        request.removeAttribute( attrName );
+        getChangedAttributesList( request, true, false ).add( attrName );
     }
     
     public Object getAttribute( RequestContext context, String attributeName )

Propchange: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DeferredSessionStorageHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/FacesBackingBeanFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/FacesBackingBeanFactory.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/FacesBackingBeanFactory.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/FacesBackingBeanFactory.java Mon Jun  6 21:49:48 2005
@@ -85,8 +85,7 @@
             //
             // We didn't create a backing bean.  If there's one in the session (an inappropriate one), remove it.
             //
-            HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
-            ScopedServletUtils.removeScopedSessionAttr( FACES_BACKING_ATTR, unwrappedRequest );
+            InternalUtils.removeCurrentFacesBackingBean( request, servletContext );
         }
         else if ( currentBean != null )
         {

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java Mon Jun  6 21:49:48 2005
@@ -25,6 +25,7 @@
 import org.apache.beehive.netui.pageflow.config.PageFlowActionFormBean;
 import org.apache.beehive.netui.pageflow.handler.Handlers;
 import org.apache.beehive.netui.pageflow.handler.ReloadableClassHandler;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.util.Bundle;
 import org.apache.beehive.netui.util.internal.ServletUtils;
@@ -286,16 +287,33 @@
         return LONGLIVED_PAGEFLOWS_ATTR_PREFIX + modulePath;
     }
     
-    public static void setCurrentPageFlow( PageFlowController jpf, HttpServletRequest request )
+    public static void setCurrentPageFlow( PageFlowController jpf, HttpServletRequest request,
+                                           ServletContext servletContext )
     {
-        setCurrentActionResolver( jpf, request );
+        setCurrentActionResolver( jpf, request, servletContext );
     }
     
-    public static void removeCurrentPageFlow( HttpServletRequest request )
+    public static void removeCurrentPageFlow( HttpServletRequest request, ServletContext servletContext )
     {
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
-        ScopedServletUtils.removeScopedSessionAttr( CURRENT_JPF_ATTR, unwrappedRequest );
-        ScopedServletUtils.removeScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
+        String currentLongLivedAttrName =
+                ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+        
+        sh.removeAttribute( rc, currentJpfAttrName );
+        sh.removeAttribute( rc, currentLongLivedAttrName );
+    }
+    
+    public static void removeCurrentFacesBackingBean( HttpServletRequest request, ServletContext servletContext )
+    {
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String attrName = ScopedServletUtils.getScopedSessionAttrName( FACES_BACKING_ATTR, unwrappedRequest );
+        
+        sh.removeAttribute( rc, attrName );
     }
     
     public static String getDecodedURI( HttpServletRequest request )
@@ -576,16 +594,21 @@
      * Set the current ActionResolver ({@link PageFlowController}) in the user session.
      * 
      * @param resolver the ActionResolver to set as the current one in the user session.
-     * @param request the current HttpServletRequest.
      */ 
-    public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request )
+    public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request,
+                                                 ServletContext servletContext )
     {
+        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
+        RequestContext rc = new RequestContext( unwrappedRequest, null );
+        String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
+        String currentLongLivedJpfAttrName =
+                ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
         
         if ( resolver == null )
         {
-            ScopedServletUtils.removeScopedSessionAttr( CURRENT_JPF_ATTR, unwrappedRequest );
-            ScopedServletUtils.removeScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+            sh.removeAttribute( rc, currentJpfAttrName );
+            sh.removeAttribute( rc, currentLongLivedJpfAttrName );
             return;
         }
         
@@ -595,20 +618,22 @@
         if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).getModuleConfig() ) )
         {
             String longLivedAttrName = getLongLivedFlowAttr( resolver.getModulePath() );
+            longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest );
             
             // Only set this attribute if it's not already there.  We want to avoid our onDestroy() callback that's
             // invoked when the page flow's session attribute is unbound.
-            if ( ScopedServletUtils.getScopedSessionAttr( longLivedAttrName, request ) != resolver )
+            if ( sh.getAttribute( rc, longLivedAttrName ) != resolver )
             {
-                ScopedServletUtils.setScopedSessionAttr( longLivedAttrName, resolver, unwrappedRequest );
+                sh.setAttribute( rc, longLivedAttrName, resolver );
             }
-            ScopedServletUtils.setScopedSessionAttr( CURRENT_LONGLIVED_ATTR, resolver.getModulePath(), unwrappedRequest );
-            ScopedServletUtils.removeScopedSessionAttr( CURRENT_JPF_ATTR, unwrappedRequest );
+            
+            sh.setAttribute( rc, currentLongLivedJpfAttrName, resolver.getModulePath() );
+            sh.removeAttribute( rc, currentJpfAttrName );
         }
         else
         {
-            ScopedServletUtils.setScopedSessionAttr( CURRENT_JPF_ATTR, resolver, unwrappedRequest );
-            ScopedServletUtils.removeScopedSessionAttr( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
+            sh.setAttribute( rc, currentJpfAttrName, resolver );
+            sh.removeAttribute( rc, currentLongLivedJpfAttrName );
         }
     }
     
@@ -665,8 +690,12 @@
     {
         if ( request instanceof HttpServletRequest )
         {
+            ServletContext servletContext = getServletContext( request );
+            StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
             HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( ( HttpServletRequest ) request );
-            return ( FacesBackingBean ) ScopedServletUtils.getScopedSessionAttr( FACES_BACKING_ATTR, unwrappedRequest );
+            RequestContext rc = new RequestContext( unwrappedRequest, null );
+            String attrName = ScopedServletUtils.getScopedSessionAttrName( FACES_BACKING_ATTR, unwrappedRequest );
+            return ( FacesBackingBean ) sh.getAttribute( rc, attrName );
         }
         
         return null;
@@ -676,15 +705,19 @@
     {
         if ( request instanceof HttpServletRequest )
         {
+            ServletContext servletContext = getServletContext( request );
+            StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
             HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( ( HttpServletRequest ) request );
+            RequestContext rc = new RequestContext( unwrappedRequest, null );
+            String attrName = ScopedServletUtils.getScopedSessionAttrName( FACES_BACKING_ATTR, unwrappedRequest );
             
             if ( bean == null )
             {
-                ScopedServletUtils.removeScopedSessionAttr( FACES_BACKING_ATTR, unwrappedRequest );
+                sh.removeAttribute( rc, attrName );
             }
             else
             {
-                ScopedServletUtils.setScopedSessionAttr( FACES_BACKING_ATTR, bean, unwrappedRequest );
+                sh.setAttribute( rc, attrName, bean );
             }
         }
     }

Copied: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java (from r171199, incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java?p2=incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java&p1=incubator/beehive/branches/rich-vnext/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/SimpleSessionStorageHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd (original)
+++ incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd Mon Jun  6 21:49:48 2005
@@ -100,6 +100,7 @@
             <xsd:element name="exceptions-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
             <xsd:element name="forward-redirect-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
             <xsd:element name="login-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
+            <xsd:element name="storage-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
             <xsd:element name="reloadable-class-handler" type="netui:handler" minOccurs="0" maxOccurs="unbounded"/>
         </xsd:sequence>
     </xsd:complexType>

Copied: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf?p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/Controller.jpf
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp?p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp?p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/first/success.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp?p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/index.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf?p2=incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/nestReturnSingleRequest/nested/Controller.jpf
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml?rev=188692&r1=188691&r2=188692&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml (original)
+++ incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/config/testRecorder-tests.xml Mon Jun  6 21:49:48 2005
@@ -5105,6 +5105,21 @@
          </features>
       </test>
       <test>
+         <name>NestReturnSingleRequest</name>
+         <description>Test to ensure that the right lifecycle methods are called when nesting/returning within a single request.</description>
+         <webapp>coreWeb</webapp>
+         <categories>
+            <category>bvt</category>
+            <category>bvt.struts11</category>
+            <category>corePageFlow</category>
+         </categories>
+         <features>
+            <feature>PageFlow</feature>
+            <feature>Nesting</feature>
+            <feature>Lifecycle</feature>
+         </features>
+      </test>
+      <test>
          <name>NonNormalizedPath</name>
          <description>Test forwarding to paths that contain '.' and '..'.  Note: there is an EXPECTED 404 response in this test.</description>
          <webapp>coreWeb</webapp>

Copied: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml (from r171199, incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml)
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml?p2=incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml&p1=incubator/beehive/branches/rich-vnext/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml&r1=171199&r2=188692&rev=188692&view=diff
==============================================================================
    (empty)

Propchange: incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/NestReturnSingleRequest.xml
------------------------------------------------------------------------------
    svn:eol-style = native