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/24 21:17:14 UTC

svn commit: r201668 - in /incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow: ./ faces/internal/ internal/

Author: rich
Date: Fri Jun 24 12:17:12 2005
New Revision: 201668

URL: http://svn.apache.org/viewcvs?rev=201668&view=rev
Log:
More work related to http://issues.apache.org/jira/browse/BEEHIVE-830 -- it seems that there are other places where a public FlowControllerFactory method can get called from outside a Page Flow request... and in these cases there will be an NPE if there's no current HttpSession.

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



Modified:
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBean.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.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/faces/internal/BackingClassMethodBinding.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.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/DefaultForwardRedirectHandler.java
    incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -97,8 +97,7 @@
      */ 
     public void ensureFailover( HttpServletRequest request )
     {
-        ServletContext servletContext = InternalUtils.getServletContext( request );
-        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
         RequestContext rc = new RequestContext( unwrappedRequest, null );
         String attr =

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FacesBackingBeanFactory.java Fri Jun 24 12:17:12 2005
@@ -108,7 +108,7 @@
         String uri = InternalUtils.getDecodedServletPath( request );
         assert uri.charAt( 0 ) == '/' : uri;
         String backingClassName = FileUtils.stripFileExtension( uri.substring( 1 ).replace( '/', '.' ) );
-        FacesBackingBean currentBean = InternalUtils.getFacesBackingBean( request );
+        FacesBackingBean currentBean = InternalUtils.getFacesBackingBean( request, getServletContext() );
         
         //
         // If there is no current backing bean, or if the current one doesn't match the desired classname, create one.

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowControllerFactory.java Fri Jun 24 12:17:12 2005
@@ -241,7 +241,7 @@
         //
         boolean createdNew = false;
         boolean isNestable = InternalUtils.isNestable( mc );
-        PageFlowStack pfStack = PageFlowStack.get( request, false );
+        PageFlowStack pfStack = PageFlowStack.get( request, getServletContext(), false );
         
         if ( isNestable && pfStack != null )
         {
@@ -294,7 +294,7 @@
                     _log.debug( "Pushing PageFlowController " + current + " onto the nesting stack" );
                 }
                 
-                if ( pfStack == null ) pfStack = PageFlowStack.get( request, true );
+                if ( pfStack == null ) pfStack = PageFlowStack.get( request, getServletContext(), true );
                 pfStack.push( current, request );
             }
             

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java Fri Jun 24 12:17:12 2005
@@ -102,7 +102,7 @@
     private String _mappingPath;
     private InternalStringBuilder _queryString;
     private boolean _explicitPath = false;
-    private String _returnFormType = null;
+    private String _outputFormBeanType = null;
     private Map _actionOutputs = null;
     private int _returnToType;
     private boolean _redirectSpecifiedOnAnnotation = false;
@@ -131,7 +131,7 @@
         _explicitPath = init._explicitPath;
         _flowController = init._flowController;
         _servletContext = init._servletContext;
-        _returnFormType = init._returnFormType;
+        _outputFormBeanType = init._outputFormBeanType;
         _actionOutputs = init._actionOutputs;
         _returnToType = init._returnToType;
         _restoreQueryString = init._restoreQueryString;
@@ -349,25 +349,25 @@
     {
         if ( _outputForms == null || _outputForms.size() == 0 )
         {
-            if ( _returnFormType != null )
+            if ( _outputFormBeanType != null )
             {
                 try
                 {
                     if ( _log.isDebugEnabled() )
                     {
-                        _log.debug( "Creating form bean of type " + _returnFormType );
+                        _log.debug( "Creating form bean of type " + _outputFormBeanType );
                     }
                     
                     ServletContext servletContext = InternalUtils.getServletContext( request );
                     ReloadableClassHandler rch = Handlers.get( servletContext ).getReloadableClassHandler();
-                    Object formBean = rch.newInstance( _returnFormType );
+                    Object formBean = rch.newInstance( _outputFormBeanType );
                     ActionForm wrappedFormBean = InternalUtils.wrapFormBean( formBean );
                     addOutputForm( wrappedFormBean );
                     return wrappedFormBean;
                 }
                 catch ( Exception e )
                 {
-                    _log.error( "Could not create form bean instance of " + _returnFormType, e );
+                    _log.error( "Could not create form bean instance of " + _outputFormBeanType, e );
                 }                
             }
             
@@ -494,18 +494,18 @@
         {
             PageFlowActionForward fc = ( PageFlowActionForward ) fwd;
             _isNestedReturn = fc.isNestedReturn();
-            _returnFormType = fc.getReturnFormType();
+            _outputFormBeanType = fc.getReturnFormType();
             _redirectSpecifiedOnAnnotation = fc.hasExplicitRedirectValue();
             _restoreQueryString = fc.isRestoreQueryString();
             _externalRedirect = fc.isExternalRedirect();
             
             Class returnFormClass = null;
             
-            if ( _returnFormType != null )
+            if ( _outputFormBeanType != null )
             {
                 try
                 {
-                    returnFormClass = Class.forName( _returnFormType );
+                    returnFormClass = Class.forName( _outputFormBeanType );
                 }
                 catch ( ClassNotFoundException e )
                 {

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -20,7 +20,6 @@
 import org.apache.beehive.netui.util.logging.Logger;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
-import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.interceptor.action.InterceptorForward;
 import org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor;
@@ -31,6 +30,7 @@
 import javax.servlet.http.HttpSessionBindingListener;
 import javax.servlet.http.HttpSessionBindingEvent;
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
 import javax.servlet.ServletContext;
 import java.util.Stack;
 import java.io.Serializable;
@@ -47,6 +47,7 @@
     private static final String JPF_STACK_ATTR = InternalConstants.ATTR_PREFIX  + "nestingStack";
     
     private Stack _stack = new Stack();
+    private transient ServletContext _servletContext;
     
     
     /**
@@ -94,52 +95,82 @@
         }
     }
     
+    /**
+     * Get the stack of nested page flows for the current user session.  Create and store an empty
+     * stack if none exists.
+     * 
+     * @param request the current HttpServletRequest.
+     * @param servletContext the current ServletContext.
+     * @return the stack of nested page flows {@link PushedPageFlow}s) for the current user session.
+     */
+    public static PageFlowStack get( HttpServletRequest request, ServletContext servletContext )
+    {
+        return get( request, servletContext, true );
+    }
+    
    /**
      * Get the stack of nested page flows for the current user session.  Create and store an empty
      * stack if none exists.
+     * @deprecated Use {@link #get(HttpServletRequest, ServletContext)} instead.
      * 
-     * @param request the current HttpServletRequest
+     * @param request the current HttpServletRequest.
      * @return the stack of nested page flows {@link PushedPageFlow}s) for the current user session.
      */
-    public static final PageFlowStack get( HttpServletRequest request )
+    public static PageFlowStack get( HttpServletRequest request )
     {
-        return get( request, true );
+        return get( request, InternalUtils.getServletContext( request ) );
     }
-
+    
     /**
      * Get the stack of nested page flows for the current user session.  Create and store an empty
      * stack if none exists.
      * 
-     * @param request the current HttpServletRequest
+     * @param request the current HttpServletRequest.
+     * @param servletContext the current ServletContext.
      * @return a {@link PageFlowStack} of nested page flows ({@link PageFlowController}s) for the current user session.
      */    
-    public static PageFlowStack get( HttpServletRequest request, boolean createIfNotExist )
+    public static PageFlowStack get( HttpServletRequest request, ServletContext servletContext, boolean createIfNotExist )
     {
-        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 )
         {
-            jpfStack = new PageFlowStack();
+            jpfStack = new PageFlowStack( servletContext );
             jpfStack.save( request );
         }
-
+        else if ( jpfStack != null )
+        {
+            jpfStack.setServletContext( servletContext );
+        }
+        
         return jpfStack;
     }
+
+    /**
+     * Get the stack of nested page flows for the current user session.  Create and store an empty
+     * stack if none exists.
+     * @deprecated Use {@link #get(HttpServletRequest, ServletContext, boolean)} instead.
+     * 
+     * @param request the current HttpServletRequest
+     * @return a {@link PageFlowStack} of nested page flows ({@link PageFlowController}s) for the current user session.
+     */    
+    public static PageFlowStack get( HttpServletRequest request, boolean createIfNotExist )
+    {
+        return get( request, InternalUtils.getServletContext( request ), createIfNotExist );
+    }
     
     /**
      * Destroy the stack of {@link PageFlowController}s that have invoked nested page flows.
      * 
      * @param request the current HttpServletRequest.
      */ 
-    public static void destroy( HttpServletRequest request )
+    public void destroy( HttpServletRequest request )
     {
-        ServletContext servletContext = InternalUtils.getServletContext( request );
-        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
         RequestContext rc = new RequestContext( unwrappedRequest, null );
         String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
@@ -219,8 +250,7 @@
     
     void save( HttpServletRequest request )
     {
-        ServletContext servletContext = InternalUtils.getServletContext( request );
-        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
         RequestContext rc = new RequestContext( unwrappedRequest, null );
         String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
@@ -228,8 +258,9 @@
         sh.setAttribute( rc, attrName, this );
     }
     
-    PageFlowStack()
+    private PageFlowStack( ServletContext servletContext )
     {
+        _servletContext = servletContext;
     }
     
     /**
@@ -258,12 +289,7 @@
         pageFlow.setIsOnNestingStack( true );
         
         // To ensure that this attribute is replicated for session failover.
-        // First, we can only use the page flow's transient ServletContext reference if it hasn't lost it.
-        // The user never has to deal with this possibility because we always reinitialize it before user
-        // code, but here we don't have that guarantee.
-        ServletContext servletContext = pageFlow.getServletContext();
-        if ( servletContext == null ) servletContext = InternalUtils.getServletContext( request );
-        ensureFailover( request, servletContext );
+        ensureFailover( request, getServletContext() );
     }
     
     /**
@@ -280,15 +306,10 @@
         
         if ( request != null )  // may be null if we're called from valueUnbound()
         {
-            ServletContext servletContext = pfc.getServletContext();
-            
-            // The ServletContext reference will be null if the page flow has been serialized/deserialized.
-            if ( servletContext == null )
-            {
-                servletContext = InternalUtils.getServletContext( request );
-                pfc.reinitialize( request, null, servletContext );
-            }
+            ServletContext servletContext = getServletContext();
             
+            // Reinitialize the page flow, in case it's lost its transient state.
+            pfc.reinitialize( request, null, servletContext );
             ensureFailover( request, servletContext );   // to ensure that this attribute is replicated for session failover
         }
         
@@ -348,10 +369,8 @@
             
             // Note that this page flow may have been serialized/deserialized, which will cause its transient info
             // to be lost.  Rehydrate it.
-            if ( jpf.getServletContext() == null )
-            {
-                jpf.reinitialize( null, null, event.getSession().getServletContext() );
-            }
+            HttpSession session = event.getSession();
+            if ( session != null ) jpf.reinitialize( null, null, session.getServletContext() );
             
             if ( ! jpf.isLongLived() ) jpf.destroy( event.getSession() );
         }
@@ -370,5 +389,15 @@
         }
         
         return ret;
+    }
+
+    private ServletContext getServletContext()
+    {
+        return _servletContext;
+    }
+
+    private void setServletContext( ServletContext servletContext )
+    {
+        _servletContext = servletContext;
     }
 }

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -185,14 +185,15 @@
      * Get the stack of nested page flows for the current user session.  Create and store an empty
      * stack if none exists.
      * 
-     * @deprecated Use {@link PageFlowStack#get} instead.
+     * @deprecated Use {@link PageFlowStack#get(HttpServletRequest, ServletContext)} instead.
      * 
      * @param request the current HttpServletRequest
      * @return a {@link PageFlowStack} of nested page flows ({@link PageFlowController}s) for the current user session.
      */
     public static final Stack getPageFlowStack( HttpServletRequest request )
     {
-        return PageFlowStack.get( request, true ).getLegacyStack();
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        return PageFlowStack.get( request, servletContext, true ).getLegacyStack();
     }
     
     /**
@@ -204,11 +205,13 @@
      */ 
     public static void destroyPageFlowStack( HttpServletRequest request )
     {
-        PageFlowStack.destroy( request );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        PageFlowStack.get( request, servletContext ).destroy( request );
     }
     
     /**
      * Get the {@link PageFlowController} that is nesting the current one.
+     * @deprecated Use {@link #getNestingPageFlow(HttpServletRequest, ServletContext)} instead.
      * 
      * @param request the current HttpServletRequest.
      * @return the nesting {@link PageFlowController}, or <code>null</code> if the current one
@@ -216,7 +219,21 @@
      */ 
     public static PageFlowController getNestingPageFlow( HttpServletRequest request )
     {
-        PageFlowStack jpfStack = PageFlowStack.get( request, false );
+        ServletContext servletContext = InternalUtils.getServletContext( request );
+        return getNestingPageFlow( request, servletContext );
+    }
+    
+    /**
+     * Get the {@link PageFlowController} that is nesting the current one.
+     * 
+     * @param request the current HttpServletRequest.
+     * @param servletContext the current ServletContext.
+     * @return the nesting {@link PageFlowController}, or <code>null</code> if the current one
+     *         is not being nested.
+     */ 
+    public static PageFlowController getNestingPageFlow( HttpServletRequest request, ServletContext servletContext )
+    {
+        PageFlowStack jpfStack = PageFlowStack.get( request, servletContext, false );
         
         if ( jpfStack != null && ! jpfStack.isEmpty() )
         {

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -118,8 +118,7 @@
      */ 
     public void persistInSession( HttpServletRequest request, HttpServletResponse response )
     {
-        ServletContext servletContext = InternalUtils.getServletContext( request );
-        StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
+        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
         RequestContext rc = new RequestContext( unwrappedRequest, null );
         sh.setAttribute( rc, InternalConstants.SHARED_FLOW_ATTR_PREFIX + getClass().getName(), this );

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/BackingClassMethodBinding.java Fri Jun 24 12:17:12 2005
@@ -90,17 +90,17 @@
             Object request = context.getExternalContext().getRequest();
             assert request != null;
             assert request instanceof HttpServletRequest : request.getClass().getName();
+            Object servletContextObject = context.getExternalContext().getContext();
+            assert servletContextObject instanceof ServletContext : servletContextObject.getClass().getName();
+            ServletContext servletContext = ( ServletContext ) servletContextObject;
             
             HttpServletRequest httpRequest = ( HttpServletRequest ) request;
-            Object backingBean = InternalUtils.getFacesBackingBean( httpRequest );
+            Object backingBean = InternalUtils.getFacesBackingBean( httpRequest, servletContext );
             
             if ( backingBean != null )
             {
                 Class backingClass = backingBean.getClass();
                 
-                Object servletContextObject = context.getExternalContext().getContext();
-                assert servletContextObject instanceof ServletContext : servletContextObject.getClass().getName();
-                ServletContext servletContext = ( ServletContext ) servletContextObject;
                 Method method = _methodCache.getMethod( backingClass, _methodName, _params );
                 
                 if ( method == null ) throw new MethodNotFoundException( _methodName );

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java Fri Jun 24 12:17:12 2005
@@ -159,7 +159,7 @@
         }
         
         UIViewRoot viewRoot = _delegate.createView( context, viewId );
-        savePreviousPageInfo( httpRequest, viewId, viewRoot );
+        savePreviousPageInfo( httpRequest, externalContext, viewId, viewRoot );
         return viewRoot;
     }
 
@@ -220,17 +220,19 @@
         }
         
         UIViewRoot viewRoot = _delegate.restoreView( context, viewId );
-        savePreviousPageInfo( httpRequest, viewId, viewRoot );
+        savePreviousPageInfo( httpRequest, externalContext, viewId, viewRoot );
         return viewRoot;
     }
 
-    private static void savePreviousPageInfo( HttpServletRequest request, String viewID, UIViewRoot viewRoot )
+    private static void savePreviousPageInfo( HttpServletRequest request, ExternalContext externalContext,
+                                              String viewID, UIViewRoot viewRoot )
     {
         //
         // Save the current view state in the PreviousPageInfo structure of the current page flow.
         //
         if ( request != null )
         {
+            ServletContext servletContext = ( ServletContext ) externalContext.getContext();
             PageFlowController curPageFlow = PageFlowUtils.getCurrentPageFlow( request );
             
             if ( curPageFlow != null && ! curPageFlow.isPreviousPageInfoDisabled() )
@@ -245,7 +247,7 @@
                 if ( viewID.equals( currentForwardPath ) )
                 {
                     PreviousPageInfo prevPageInfo = curPageFlow.getCurrentPageInfo();
-                    FacesBackingBean backingBean = InternalUtils.getFacesBackingBean( request );
+                    FacesBackingBean backingBean = InternalUtils.getFacesBackingBean( request, servletContext );
                     prevPageInfo.setClientState( new PageClientState( viewRoot, backingBean ) );
                 }
             }

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -440,7 +440,7 @@
         HttpServletRequest request = ( HttpServletRequest ) context.getRequest();
         HttpServletResponse response = ( HttpServletResponse ) context.getResponse();
         
-        PageFlowStack pfStack = PageFlowStack.get( request );
+        PageFlowStack pfStack = PageFlowStack.get( request, getServletContext() );
         String returnAction = pageFlowFwd.getPath();
                 
         if ( pfStack.isEmpty() )

Modified: incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultForwardRedirectHandler.java
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultForwardRedirectHandler.java?rev=201668&r1=201667&r2=201668&view=diff
==============================================================================
--- incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultForwardRedirectHandler.java (original)
+++ incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultForwardRedirectHandler.java Fri Jun 24 12:17:12 2005
@@ -84,7 +84,7 @@
         //
         // See if we've exceeded the maximum nesting depth.
         //
-        PageFlowStack pfStack = PageFlowStack.get( request, false );
+        PageFlowStack pfStack = PageFlowStack.get( request, getServletContext(), false );
         
         int nestingOverflowCount = settings.getNestingOverflowCount();
         if ( pfStack != null && pfStack.size() > nestingOverflowCount )

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=201668&r1=201667&r2=201668&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 Fri Jun 24 12:17:12 2005
@@ -390,11 +390,19 @@
         return map;
     }
     
+    public static Map getPageInputMap( ServletRequest request, ServletContext servletContext )
+    {
+        Map actionOutputsFromPageFlow = getActionOutputMap( request, false );
+        if ( actionOutputsFromPageFlow != null ) return actionOutputsFromPageFlow;
+        FacesBackingBean fbb = getFacesBackingBean( request, servletContext );
+        return fbb != null ? fbb.getPageInputMap() : null;
+    }
+    
     public static Map getPageInputMap( ServletRequest request )
     {
         Map actionOutputsFromPageFlow = getActionOutputMap( request, false );
         if ( actionOutputsFromPageFlow != null ) return actionOutputsFromPageFlow;
-        FacesBackingBean fbb = getFacesBackingBean( request );
+        FacesBackingBean fbb = getFacesBackingBean( request, getServletContext( request ) );
         return fbb != null ? fbb.getPageInputMap() : null;
     }
     
@@ -686,11 +694,10 @@
     }
     
 
-    public static FacesBackingBean getFacesBackingBean( ServletRequest request )
+    public static FacesBackingBean getFacesBackingBean( ServletRequest request, ServletContext servletContext )
     {
         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 );