Author: rich
Date: Sun Jan 30 22:58:37 2005
New Revision: 149229

URL: http://svn.apache.org/viewcvs?view=rev&rev=149229
Log:
- Reworked the Handler layer. Handlers can override base Page Flow framework 
behavior, and are registered in WEB-INF/netui-config.xml.  You can now register 
multiple Handlers of a particular type (e.g., login-handler), and each one will 
be initialized with a reference to the previous one (an "adapter" pattern 
similar to the one JSF uses for its handlers).  Registration in 
netui-config.xml looks like this:

    <pageflow-handlers>
        <action-forward-handler>
            <handler-class>test.MyActionForwardHandler</handler-class>
        </action-forward-handler>
        <exceptions-handler>
            <handler-class>test.MyExceptionsHandler</handler-class>
        </exceptions-handler>
        <forward-redirect-handler>
            <handler-class>test.MyForwardRedirectHandler</handler-class>
        </forward-redirect-handler>
        <login-handler>
            <handler-class>test.MyLoginHandler</handler-class>
        </login-handler>
        <login-handler>
            <handler-class>test.AnotherLoginHandler</handler-class>
        </login-handler>
    </pageflow-handlers>

  User Handler classes normally extend 
org.apache.beehive.netui.pageflow.handler.BaseHandler, and implement 
org.apache.beehive.netui.pageflow.handler.{Login,Exceptions,etc.}Handler.  

- General cleanup and refactoring.

DRT/BVT: netui (WinXP)
BB: self


Added:
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/RequestContext.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ActionForwardHandler.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/BaseHandler.java
      - copied, changed from r148858, 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/FlowControllerHandlerContext.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/HandlerConfig.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handlers.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultHandler.java
   (with props)
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/LegacySettings.java
      - copied, changed from r148858, 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ContextCache.java
    incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/handlers/
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/handlers/Controller.jpf
   (with props)
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/miniTests/handlers/index.jsp
   (with props)
    
incubator/beehive/trunk/netui/test/webapps/drt/testRecorder/tests/Handlers.xml  
 (with props)
Removed:
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/ForwardHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/ContextCache.java
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/DefaultServletContainerAdapter.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/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/PageFlowContextListener.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/PageFlowEventReporter.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.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/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/handler/ExceptionsHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ForwardRedirectHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/Handler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/LoginHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/handler/ReloadableClassHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnyBeanActionForm.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.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/DefaultLoginHandler.java
    
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultReloadableClassHandler.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/scoping/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java
    
incubator/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/html/Form.java
    
incubator/beehive/trunk/netui/src/util/org/apache/beehive/netui/util/ServletUtils.java
    incubator/beehive/trunk/netui/src/util/schema/netui-config/netui-config.xsd
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/WEB-INF/local-netui-config.xml
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/mockportal/smokeTest/results.jsp
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/pageFlowCore/forwards/Controller.jpf
    
incubator/beehive/trunk/netui/test/webapps/drt/coreWeb/validation/addExpressionMessages/Controller.jpf
    
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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -17,11 +17,12 @@
  */
 package org.apache.beehive.netui.pageflow;
 
-import org.apache.beehive.netui.pageflow.internal.ContextCache;
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.internal.RequestValues;
 import org.apache.beehive.netui.pageflow.handler.ForwardRedirectHandler;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.FlowControllerHandlerContext;
 import org.apache.beehive.netui.util.Bundle;
 import org.apache.beehive.netui.util.DiscoveryUtils;
 import org.apache.beehive.netui.util.ServletUtils;
@@ -84,7 +85,7 @@
     private transient Digester _cachedConfigDigester = null;
     private Map _configParams = null;
     private ModuleConfigLocator[] _moduleConfigLocators = null;
-    private ContextCache _contextCache;
+    private Handlers _handlers;
     
     private static final Logger _log = Logger.getInstance( 
AutoRegisterActionServlet.class );
 
@@ -94,7 +95,7 @@
     public void init( ServletConfig servletConfig )
         throws ServletException
     {
-        _contextCache = ContextCache.get( servletConfig.getServletContext() );
+        _handlers = Handlers.get( servletConfig.getServletContext() );
         setupModuleConfigLocators( servletConfig );
         super.init( servletConfig );
     }
@@ -581,7 +582,8 @@
         // First, reinitialize the page flow classloader, for reloading when 
recompile occurs in dev mode.
         //
         ServletContext servletContext = getServletContext();
-        _contextCache.getReloadableClassHandler().reinit( request );
+        FlowControllerHandlerContext handlerContext = new 
FlowControllerHandlerContext( request, response, null );
+        _handlers.getReloadableClassHandler().reloadClasses( handlerContext );
         
         String modulePath = PageFlowUtils.getModulePathForRelativeURI( 
InternalUtils.getDecodedServletPath( request ) );
         ModuleConfig registeredApp;
@@ -652,8 +654,8 @@
                     sfActionURI.append( '/' );
                     sfActionURI.append( ServletUtils.getBaseName( relativeURI 
) );
                     RequestValues.setOriginalServletPath( request, relativeURI 
);
-                    ForwardRedirectHandler frh = 
_contextCache.getForwardRedirectHandler();
-                    frh.forward( sfActionURI.toString(), request, response );
+                    ForwardRedirectHandler frh = 
_handlers.getForwardRedirectHandler();
+                    frh.forward( handlerContext, sfActionURI.toString() );
                     return;
                 }
                 

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java?view=diff&r1=149228&r2=149229
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/DefaultServletContainerAdapter.java
 Sun Jan 30 22:58:37 2005
@@ -176,7 +176,7 @@
         }
 
         public void actionRaised( FlowController flowController, ActionMapping 
mapping, ActionForm form,
-                                  HttpServletRequest request, 
HttpServletResponse response )
+                                  ServletRequest request, ServletResponse 
response )
         {
             if ( _log.isDebugEnabled() )
             {
@@ -184,14 +184,14 @@
                 msg.addParam( "FlowController", flowController );
                 msg.addParam( "ActionMapping", mapping );
                 msg.addParam( "ActionForm", form );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
         }
 
         public void actionSuccess( FlowController flowController, 
ActionMapping mapping, ActionForm form,
-                                   HttpServletRequest request, 
HttpServletResponse response, ActionForward result )
+                                   ServletRequest request, ServletResponse 
response, ActionForward result )
         {
             if ( _log.isDebugEnabled() )
             {
@@ -199,7 +199,7 @@
                 msg.addParam( "FlowController", flowController );
                 msg.addParam( "ActionMapping", mapping );
                 msg.addParam( "ActionForm", form );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 msg.addParam( "ActionForward", result );
                 _log.debug( msg );
@@ -207,8 +207,8 @@
         }
 
         public void exceptionRaised( Throwable ex, ActionMapping 
actionMapping, ActionForm form,
-                                     FlowController flowController, 
HttpServletRequest request,
-                                     HttpServletResponse response )
+                                     FlowController flowController, 
ServletRequest request,
+                                     ServletResponse response )
         {
             if ( _log.isDebugEnabled() )
             {
@@ -217,15 +217,15 @@
                 msg.addParam( "ActionMapping", actionMapping );
                 msg.addParam( "ActionForm", form );
                 msg.addParam( "FlowController", flowController );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
         }
 
         public void exceptionHandled( Throwable ex, ActionMapping 
actionMapping, ActionForm form,
-                                      FlowController flowController, 
HttpServletRequest request,
-                                      HttpServletResponse response, 
ActionForward result )
+                                      FlowController flowController, 
ServletRequest request,
+                                      ServletResponse response, ActionForward 
result )
         {
             if ( _log.isDebugEnabled() )
             {
@@ -234,21 +234,21 @@
                 msg.addParam( "ActionMapping", actionMapping );
                 msg.addParam( "ActionForm", form );
                 msg.addParam( "FlowController", flowController );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 msg.addParam( "ActionForward", result );
                 _log.debug( msg );
             }
         }
 
-        public void flowControllerCreated( FlowController flowController, 
HttpServletRequest request,
-                                           HttpServletResponse response )
+        public void flowControllerCreated( FlowController flowController, 
ServletRequest request,
+                                           ServletResponse response )
         {
             if ( _log.isDebugEnabled() )
             {
                 LogMsg msg = new LogMsg( "flowControllerCreated" );
                 msg.addParam( "FlowController", flowController );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
@@ -264,45 +264,45 @@
             }
         }
 
-        public void beginActionRequest( HttpServletRequest request, 
HttpServletResponse response )
+        public void beginActionRequest( ServletRequest request, 
ServletResponse response )
         {
             if ( _log.isDebugEnabled() )
             {
                 LogMsg msg = new LogMsg( "beginActionRequest" );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
         }
 
-        public void endActionRequest( HttpServletRequest request, 
HttpServletResponse response )
+        public void endActionRequest( ServletRequest request, ServletResponse 
response )
         {
             if ( _log.isDebugEnabled() )
             {
                 LogMsg msg = new LogMsg( "endActionRequest" );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
         }
 
-        public void beginPageRequest( HttpServletRequest request, 
HttpServletResponse response )
+        public void beginPageRequest( ServletRequest request, ServletResponse 
response )
         {
             if ( _log.isDebugEnabled() )
             {
                 LogMsg msg = new LogMsg( "beginPageRequest" );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }
         }
 
-        public void endPageRequest( HttpServletRequest request, 
HttpServletResponse response )
+        public void endPageRequest( ServletRequest request, ServletResponse 
response )
         {
             if ( _log.isDebugEnabled() )
             {
                 LogMsg msg = new LogMsg( "endPageRequest" );
-                msg.addParam( "Request", request != null ? 
request.getRequestURI() : null );
+                msg.addParam( "Request", request );
                 msg.addParam( "Response", response );
                 _log.debug( msg );
             }

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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -20,12 +20,14 @@
 import org.apache.beehive.netui.core.urls.MutableURI;
 import org.apache.beehive.netui.pageflow.annotations.Jpf;
 import org.apache.beehive.netui.pageflow.config.PageFlowActionMapping;
-import org.apache.beehive.netui.pageflow.internal.ContextCache;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.internal.InternalExpressionUtils;
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.handler.LoginHandler;
 import org.apache.beehive.netui.pageflow.handler.ExceptionsHandler;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.FlowControllerHandlerContext;
+import org.apache.beehive.netui.pageflow.handler.ActionForwardHandler;
 import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
 import org.apache.beehive.netui.util.FileUtils;
 import org.apache.beehive.netui.util.cache.ClassLevelCache;
@@ -48,6 +50,7 @@
 import javax.security.auth.login.LoginException;
 import javax.servlet.ServletContext;
 import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
 import javax.servlet.jsp.el.ELException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -191,8 +194,8 @@
     public void login( String username, String password )
         throws LoginException
     {
-        LoginHandler lh = ContextCache.get( getServletContext() 
).getLoginHandler();
-        lh.login( username, password, getRequest(), getResponse() );
+        LoginHandler lh = Handlers.get( getServletContext() 
).getLoginHandler();
+        lh.login( getHandlerContext(), username, password );
     }
     
     /**
@@ -207,8 +210,8 @@
      */
     public void logout( boolean invalidateSessions )
     {
-        LoginHandler lh = ContextCache.get( getServletContext() 
).getLoginHandler();
-        lh.logout( invalidateSessions, getRequest(), getResponse() );
+        LoginHandler lh = Handlers.get( getServletContext() 
).getLoginHandler();
+        lh.logout( getHandlerContext(), invalidateSessions );
     }
 
     /**
@@ -247,21 +250,22 @@
      * @return a Struts ActionForward object that specifies the URI that 
should be displayed.
      * @throws ServletException if another Exception is thrown during handling 
of <code>ex</code>.
      */ 
-    protected synchronized ActionForward handleException( Throwable ex, 
ActionMapping mapping,
-                                                          ActionForm form, 
HttpServletRequest request,
-                                                          HttpServletResponse 
response )
+    public synchronized ActionForward handleException( Throwable ex, 
ActionMapping mapping,
+                                                       ActionForm form, 
HttpServletRequest request,
+                                                       HttpServletResponse 
response )
         throws IOException, ServletException
     {
         PerRequestState prevState = setPerRequestState( new PerRequestState( 
request, response, mapping ) );
         
         try
         {
-            ExceptionsHandler eh = ContextCache.get( getServletContext() 
).getExceptionsHandler();
+            ExceptionsHandler eh = Handlers.get( getServletContext() 
).getExceptionsHandler();
+            FlowControllerHandlerContext context = getHandlerContext();
             
             // First, put the exception into the request (or other applicable 
context).
-            Throwable unwrapped = eh.unwrapException( ex );
-            eh.exposeException( unwrapped, mapping, request, response, 
getServletContext() );
-            return eh.handleException( unwrapped, mapping, form, this, 
request, response, getServletContext() );
+            Throwable unwrapped = eh.unwrapException( context, ex );
+            eh.exposeException( context, unwrapped, mapping );
+            return eh.handleException( context, unwrapped, mapping, form );
         }
         finally
         {
@@ -408,10 +412,10 @@
             //
             // Check whether isLoginRequired=true for this action.
             //
-            LoginHandler loginHandler = ContextCache.get( getServletContext() 
).getLoginHandler();
+            LoginHandler loginHandler = Handlers.get( getServletContext() 
).getLoginHandler();
             
             if ( pfActionMapping != null && pfActionMapping.isLoginRequired()
-                 && loginHandler.getUserPrincipal( request ) == null )
+                 && loginHandler.getUserPrincipal( getHandlerContext() ) == 
null )
             {
                 NotLoggedInException ex = createNotLoggedInException( 
actionName, request );
                 return handleException( ex, mapping, form, request, response );
@@ -488,11 +492,11 @@
                              ActionForm form, ServletContext servletContext )
     {
         //
-        // This method is overridden in PageFlowController -- even though 
we're just delegating here, we
-        // can't actually remove it.
+        // This method is overridden in PageFlowController. Even though we're 
just delegating here, we can't remove it.
         //
-        return ForwardHandler.forwardTo( fwd, mapping, request, response, 
actionName, altModuleConfig, form,
-                                         servletContext, this );
+        ActionForwardHandler handler = Handlers.get( servletContext 
).getActionForwardHandler();
+        FlowControllerHandlerContext context = new 
FlowControllerHandlerContext( request, response, this );
+        return handler.doForward( context, fwd, mapping, actionName, 
altModuleConfig, form );
     }
     
     NotLoggedInException createNotLoggedInException( String actionName, 
HttpServletRequest request )
@@ -595,14 +599,14 @@
      * user session.  [EMAIL PROTECTED] FlowController#getRequest}, [EMAIL 
PROTECTED] FlowController#getResponse}, and [EMAIL PROTECTED] 
FlowController#getActionMapping} may <i>not</i>
      * be used during this method, since it may be called due to session 
termination outside of a
      * request.  [EMAIL PROTECTED] FlowController#getSession} also may not be 
used, but the session is passed as an argument
-     * to [EMAIL PROTECTED] 
FlowController#onDestroy(javax.servlet.http.HttpSession)}, which should be used 
in place of this
+     * to [EMAIL PROTECTED] FlowController#onDestroy(HttpSession)}, which 
should be used in place of this
      * method.
      * <br>
      * Note that this method is <strong>not synchronized</strong>.  It is 
dangerous to synchronize your override of
      * this method because it is invoked during a callback from the Servlet 
container.  Depending on the container,
      * synchronization here can cause deadlocks.
      *
-     * @deprecated [EMAIL PROTECTED] 
FlowController#onDestroy(javax.servlet.http.HttpSession)} should be used 
instead. 
+     * @deprecated [EMAIL PROTECTED] FlowController#onDestroy(HttpSession)} 
should be used instead. 
      */ 
     protected void onDestroy()
     {
@@ -623,10 +627,10 @@
     }
     
     /**
-     * This helps implement the deprecated return-to="page" behavior, which 
changes depending on whether
-     * you're executing an action in Global.app or the current pageflow.
+     * Get a legacy PreviousPageInfo.
+     * @deprecated This method will be removed without replacement in a future 
release.
      */ 
-    abstract PreviousPageInfo getPreviousPageInfoLegacy( PageFlowController 
curJpf, HttpServletRequest request );
+    public abstract PreviousPageInfo getPreviousPageInfoLegacy( 
PageFlowController curJpf, HttpServletRequest request );
     
     /**
      * Get an action handler method of the given name/signature
@@ -698,7 +702,7 @@
             
             if ( formClassName != null )
             {
-                return InternalUtils.getReloadableClass( formClassName, 
request, getServletContext() );
+                return InternalUtils.getReloadableClass( formClassName, 
getServletContext() );
             }
         }
         
@@ -1172,11 +1176,12 @@
     }
     
     /**
-     * Used by derived classes to store information on the most recent page 
forwarded to.
+     * Store information about recent pages displayed.  Usually should not be 
called directly.
+     * @exclude
      */ 
-    void savePreviousPageInfo( ActionForward forward, ActionForm form, 
ActionMapping mapping,
-                               HttpServletRequest request, ServletContext 
servletContext,
-                               boolean isSpecialForward )
+    public void savePreviousPageInfo( ActionForward forward, ActionForm form, 
ActionMapping mapping,
+                                      HttpServletRequest request, 
ServletContext servletContext,
+                                      boolean isSpecialForward )
     {
     }
 
@@ -1371,8 +1376,9 @@
                     }
                 }
             
-                return ForwardHandler.forwardTo( retVal, actionMapping, 
request, response, actionName,
-                                                 getModuleConfig(), 
wrappedFormBean, getServletContext(), this );
+                ActionForwardHandler handler = Handlers.get( 
getServletContext() ).getActionForwardHandler();
+                return handler.doForward( getHandlerContext(), retVal, 
actionMapping, actionName, getModuleConfig(),
+                                          wrappedFormBean );
             }
             catch ( InvocationTargetException e )
             {
@@ -1393,8 +1399,11 @@
             _log.error( "Exception while handling exception " + 
ex.getClass().getName()
                         + ".  The original exception will be thrown.", e );
             
-            ExceptionsHandler eh = ContextCache.get( getServletContext() 
).getExceptionsHandler();
-            if ( ! eh.eatUnhandledException( eh.unwrapException( e ), request, 
response, getServletContext() ) )
+            ExceptionsHandler eh = Handlers.get( getServletContext() 
).getExceptionsHandler();
+            FlowControllerHandlerContext context = new 
FlowControllerHandlerContext( request, response, this );
+            Throwable unwrapped = eh.unwrapException( context, e );
+            
+            if ( ! eh.eatUnhandledException( context, unwrapped ) )
             {
                 if ( ex instanceof ServletException ) throw ( ServletException 
) ex;
                 if ( ex instanceof IOException ) throw ( IOException ) ex;
@@ -1416,9 +1425,9 @@
      * @param messageKey the message-resources key for the message.
      * @param messageArgs zero or more arguments to the message.
      */ 
-    public void addActionMessage( String propertyName, String messageKey, 
Object ... messageArgs )
+    public void addActionError( String propertyName, String messageKey, Object 
... messageArgs )
     {
-        InternalUtils.addActionMessage( propertyName, new ActionMessage( 
messageKey, messageArgs ), getRequest() );
+        InternalUtils.addActionError( propertyName, new ActionMessage( 
messageKey, messageArgs ), getRequest() );
     }
     
     /**
@@ -1428,14 +1437,14 @@
      * @param expression the expression that will be evaluated to generate the 
error message.
      * @param messageArgs zero or more arguments to the message.
      */ 
-    public void addActionMessageExpression( String propertyName, String 
expression, Object ... messageArgs )
+    public void addActionErrorExpression( String propertyName, String 
expression, Object ... messageArgs )
     {
-        InternalUtils.addActionMessage( propertyName, new ExpressionMessage( 
expression, messageArgs ), getRequest() );
+        InternalUtils.addActionError( propertyName, new ExpressionMessage( 
expression, messageArgs ), getRequest() );
     }
     
     /**
      * Add a validation error that will be shown with the Errors and Error 
tags.
-     * @deprecated Use [EMAIL PROTECTED] #addActionMessage} instead.
+     * @deprecated Use [EMAIL PROTECTED] #addActionError} instead.
      * 
      * @param propertyName the name of the property with which to associate 
this error.
      * @param messageKey the message-resources key for the error message.
@@ -1448,7 +1457,7 @@
     
     /**
      * Add a validation error that will be shown with the Errors and Error 
tags.
-     * @deprecated Use [EMAIL PROTECTED] #addActionMessage} instead.
+     * @deprecated Use [EMAIL PROTECTED] #addActionError} instead.
      * 
      * @param propertyName the name of the property with which to associate 
this error.
      * @param messageKey the message-resources key for the error message.
@@ -1521,32 +1530,18 @@
         return defaultLocale;
     }
     
-
     /**
-     * Generate a new transaction token, to be used for enforcing a single 
request for a particular transaction.
-     *
-     * @param request the current request.
-     * @deprecated Use
-     */
-    protected String generateToken( HttpServletRequest request )
-    {
-        return TOKEN_PROCESSOR.generateToken( request );
-    }
-
-    /**
-     * Return the default data source for the module associated with this page 
flow.
+     * Return the default data source for the Struts module associated with 
this page flow.
      *
      * @param request the current request.
      */
     protected DataSource getDataSource( HttpServletRequest request )
     {
-
         return getDataSource( request, Globals.DATA_SOURCE_KEY );
-
     }
 
     /**
-     * Return the specified data source for the current module.
+     * Return the specified data source for the current Struts module.
      *
      * @param request The servlet request we are processing
      * @param key     The key specified in the
@@ -1555,12 +1550,8 @@
      */
     protected DataSource getDataSource( HttpServletRequest request, String key 
)
     {
-
-        ModuleConfig moduleConfig = getModuleConfig();
-
         // Return the requested data source instance
-        return ( DataSource ) getServletContext().getAttribute( key + 
moduleConfig.getPrefix() );
-
+        return ( DataSource ) getServletContext().getAttribute( key + 
getModuleConfig().getPrefix() );
     }
 
 
@@ -1569,7 +1560,7 @@
      *
      * @param request the current request.
      * @return the user's currently selected Locale, stored in the session.
-     * @deprecated Use [EMAIL PROTECTED] #getLocale()}.
+     * @deprecated Use [EMAIL PROTECTED] #getLocale} or [EMAIL PROTECTED] 
#retrieveUserLocale}.
      */
     protected Locale getLocale( HttpServletRequest request )
     {
@@ -1580,32 +1571,22 @@
     }
 
     /**
-     * Return the user's currently selected Locale.
+     * Get the user's currently selected Locale.
      *
      * @return the user's currently selected Locale, stored in the session.
      */
     protected Locale getLocale()
     {
-        Locale locale = ( Locale ) getSession().getAttribute( 
Globals.LOCALE_KEY );
-        return locale != null ? locale : DEFAULT_LOCALE;
+        return retrieveUserLocale( getRequest(), null );
     }
 
     public static Locale retrieveUserLocale( HttpServletRequest request, 
String locale )
     {
-        if ( locale == null )
-        {
-            locale = Globals.LOCALE_KEY;
-        }
+        if ( locale == null ) locale = Globals.LOCALE_KEY;
         HttpSession session = request.getSession( false );
         Locale userLocale = null;
-        if ( session != null )
-        {
-            userLocale = ( Locale ) session.getAttribute( locale );
-        }
-        if ( userLocale == null )
-        {
-            userLocale = DEFAULT_LOCALE;
-        }
+        if ( session != null ) userLocale = ( Locale ) session.getAttribute( 
locale );
+        if ( userLocale == null ) userLocale = DEFAULT_LOCALE;
         return userLocale;
     }
 
@@ -1614,58 +1595,68 @@
      * Return the message resources for the default module.
      *
      * @deprecated This method can only return the resources for the default
-     *             module.  Use getResources(HttpServletRequest) to get the
-     *             resources for the current module.
+     *             module.  Use [EMAIL PROTECTED] #getMessageResources()} to 
get the
+     *             resources for this page flow.
      */
     protected MessageResources getResources()
     {
-
-        return ( MessageResources )
-                getServletContext().getAttribute( Globals.MESSAGES_KEY );
-
+        return ( MessageResources ) getServletContext().getAttribute( 
Globals.MESSAGES_KEY );
     }
 
-
     /**
      * Return the default message resources for the current module.
+     * @deprecated Use [EMAIL PROTECTED] #getMessageResources()} instead.
      *
      * @param request The servlet request we are processing
      */
     protected MessageResources getResources( HttpServletRequest request )
     {
-
-        return ( ( MessageResources ) request.getAttribute( 
Globals.MESSAGES_KEY ) );
-
+        return getMessageResources();
     }
 
 
     /**
      * Return the specified message resources for the current module.
+     * @deprecated Use [EMAIL PROTECTED] #getMessageResources(String)} instead.
      *
      * @param request the current request.
      * @param key     The bundle key specified in a
-     *                [EMAIL PROTECTED] Jpf.MessageResource} annotation.
-     *                <code>&lt;message-resources&gt;</code> element for the
-     *                requested bundle
-     * @since Struts 1.1
+     *                [EMAIL PROTECTED] Jpf.MessageBundle} annotation.
      */
-    protected MessageResources getResources( HttpServletRequest request,
-                                             String key )
+    protected MessageResources getResources( HttpServletRequest request, 
String key )
     {
-
-        return ( ( MessageResources ) getServletContext().getAttribute
-                ( key + getModuleConfig().getPrefix() ) );
-
+        return getMessageResources( key );
+    }
+    
+    /**
+     * Get the default message resources for this page flow.
+     */
+    protected MessageResources getMessageResources()
+    {
+        return getMessageResources( Globals.MESSAGES_KEY );
+    }
+    
+    /**
+     * Get the specified message resources for this page flow.
+     *
+     * @param key The bundle key specified in a [EMAIL PROTECTED] 
Jpf.MessageBundle} annotation.
+     */
+    protected MessageResources getMessageResources( String key )
+    {
+        return ( MessageResources ) getServletContext().getAttribute( key + 
getModuleConfig().getPrefix() );
     }
 
     /**
      * <p>Returns <code>true</code> if the current form's cancel button was
      * pressed.  This method will check if the <code>Globals.CANCEL_KEY</code>
      * request attribute has been set, which normally occurs if the cancel
-     * button generated by <strong>CancelTag</strong> was pressed by the user
+     * button generated by the Struts <strong>CancelTag</strong> was pressed 
by the user
      * in the current request.  If <code>true</code>, validation performed
      * by an <strong>ActionForm</strong>'s <code>validate()</code> method
      * will have been skipped by the controller servlet.</p>
+     * @deprecated This method will be removed without replacement in a future 
release.  The normal method for
+     *     cancelling in a form is to use the <code>action</code> attribute on
+     *     [EMAIL PROTECTED] org.apache.beehive.netui.tags.html.Button}, 
rather than avoiding validation on the current action.
      *
      * @param request The servlet request we are processing
      * @see org.apache.struts.taglib.html.CancelTag
@@ -1673,11 +1664,33 @@
     protected boolean isCancelled( HttpServletRequest request )
     {
 
-        return ( request.getAttribute( Globals.CANCEL_KEY ) != null );
+        return request.getAttribute( Globals.CANCEL_KEY ) != null;
 
     }
 
-
+    /**
+     * Generate a new transaction token, to be used for enforcing a single 
request for a particular transaction.
+     *
+     * @param request the current request.
+     * @deprecated Use [EMAIL PROTECTED] #generateToken()} instead.
+     */
+    protected String generateToken( HttpServletRequest request )
+    {
+        return TOKEN_PROCESSOR.generateToken( request );
+    }
+    
+    /**
+     * Generate a new transaction token, to be used for enforcing a single 
request for a particular transaction.
+     * 
+     * @see #isTokenValid() 
+     * @see #isTokenValid(boolean) 
+     * @see #resetToken()
+     */
+    protected String generateToken()
+    {
+        return TOKEN_PROCESSOR.generateToken( getRequest() );
+    }
+    
     /**
      * Return <code>true</code> if there is a transaction token stored in
      * the user's current session, and the value submitted as a request
@@ -1690,16 +1703,39 @@
      * <li>The included transaction token value does not match the
      * transaction token in the user's session</li>
      * </ul>
+     * @deprecated Use [EMAIL PROTECTED] #isTokenValid()} instead.
      *
      * @param request The servlet request we are processing
      */
     protected boolean isTokenValid( HttpServletRequest request )
     {
-
+        
         return TOKEN_PROCESSOR.isTokenValid( request, false );
-
+        
     }
+    
+    /**
+     * Return <code>true</code> if there is a transaction token stored in
+     * the user's current session, and the value submitted as a request
+     * parameter with this action matches it.  Returns <code>false</code>
+     * under any of the following circumstances:
+     * <ul>
+     * <li>No session associated with this request</li>
+     * <li>No transaction token saved in the session</li>
+     * <li>No transaction token included as a request parameter</li>
+     * <li>The included transaction token value does not match the
+     * transaction token in the user's session</li>
+     * </ul>
+     * 
+     * @see #generateToken() 
+     * @see #resetToken()
+     */
+    protected boolean isTokenValid()
+    {
 
+        return TOKEN_PROCESSOR.isTokenValid( getRequest(), false );
+
+    }
 
     /**
      * Return <code>true</code> if there is a transaction token stored in
@@ -1712,22 +1748,44 @@
      * <li>The included transaction token value does not match the
      * transaction token in the user's session</li>
      * </ul>
+     * @deprecated Use [EMAIL PROTECTED] #isTokenValid(boolean)} instead.
      *
      * @param request The servlet request we are processing
      * @param reset   Should we reset the token after checking it?
      */
-    protected boolean isTokenValid( HttpServletRequest request,
-                                    boolean reset )
+    protected boolean isTokenValid( HttpServletRequest request, boolean reset )
     {
-
         return TOKEN_PROCESSOR.isTokenValid( request, reset );
     }
+    
+    /**
+     * Return <code>true</code> if there is a transaction token stored in
+     * the user's current session, and the value submitted as a request
+     * parameter with this action matches it.  Returns <code>false</code>
+     * <ul>
+     * <li>No session associated with this request</li>
+     * <li>No transaction token saved in the session</li>
+     * <li>No transaction token included as a request parameter</li>
+     * <li>The included transaction token value does not match the
+     * transaction token in the user's session</li>
+     * </ul>
+     *
+     * @param reset   Should we reset the token after checking it?
+     * @see #generateToken() 
+     * @see #resetToken()
+     */
+    protected boolean isTokenValid( boolean reset )
+    {
+
+        return TOKEN_PROCESSOR.isTokenValid( getRequest(), reset );
+    }
 
 
     /**
      * Reset the saved transaction token in the user's session.  This
      * indicates that transactional token checking will not be needed
      * on the next request that is submitted.
+     * @deprecated Use [EMAIL PROTECTED] #resetToken()} instead.
      *
      * @param request The servlet request we are processing
      */
@@ -1735,58 +1793,75 @@
     {
         TOKEN_PROCESSOR.resetToken( request );
     }
+    
+    /**
+     * Reset the saved transaction token in the user's session.  This
+     * indicates that transactional token checking will not be needed
+     * on the next request that is submitted.
+     * 
+     * @see #isTokenValid() 
+     * @see #isTokenValid(boolean) 
+     * @see #generateToken() 
+     */
+    protected void resetToken()
+    {
+        TOKEN_PROCESSOR.resetToken( getRequest() );
+    }
 
 
     /**
-     * Save the specified error messages keys into the appropriate request
-     * attribute for use by the &lt;html:errors&gt; tag, if any messages
-     * are required.  Otherwise, ensure that the request attribute is not
-     * created.
+     * Save the specified messages keys into the request for use by the 
&lt;netui:error&gt; or &lt;netui:errors&gt; tags.
+     * @deprecated Use [EMAIL PROTECTED] #saveActionErrors} instead.
      *
-     * @param request The servlet request we are processing
-     * @param errors  Error messages object
+     * @param errors the ActionMessages to save in the request.
      */
-    protected void saveErrors( HttpServletRequest request,
-                               ActionMessages errors )
+    protected void saveErrors( HttpServletRequest request, ActionMessages 
errors )
     {
-
-        // Remove any error messages attribute if none are required
-        if ( errors == null || errors.isEmpty() )
-        {
-            request.removeAttribute( Globals.ERROR_KEY );
-            return;
-        }
-
-        // Save the error messages we need
-        request.setAttribute( Globals.ERROR_KEY, errors );
-
+        saveActionErrors( errors );
     }
 
 
     /**
      * Save the specified messages keys into the appropriate request
-     * attribute for use by the &lt;html:messages&gt; tag (if
+     * attribute for use by the Struts &lt;html:messages&gt; tag (if
      * messages="true" is set), if any messages are required.  Otherwise,
      * ensure that the request attribute is not created.
+     * @deprecated This method will be removed without replacement in a future 
release.
      *
      * @param request  The servlet request we are processing
      * @param messages Messages object
-     * @since Struts 1.1
      */
-    protected void saveMessages( HttpServletRequest request,
-                                 ActionMessages messages )
+    protected void saveMessages( HttpServletRequest request, ActionMessages 
messages )
     {
-
+        
         // Remove any messages attribute if none are required
         if ( messages == null || messages.isEmpty() )
         {
             request.removeAttribute( Globals.MESSAGE_KEY );
             return;
         }
-
+        
         // Save the messages we need
         request.setAttribute( Globals.MESSAGE_KEY, messages );
-
+        
+    }
+    
+    /**
+     * Save the specified messages keys into the request for use by the 
&lt;netui:error&gt; or &lt;netui:errors&gt; tags.
+     *
+     * @param errors the ActionMessages to save in the request.
+     */
+    protected void saveActionErrors( ActionMessages errors )
+    {
+        // Remove any messages attribute if none are required
+        if ( errors == null || errors.isEmpty() )
+        {
+            getRequest().removeAttribute( Globals.MESSAGE_KEY );
+        }
+        else
+        {
+            getRequest().setAttribute( Globals.MESSAGE_KEY, errors );
+        }
     }
 
 
@@ -1808,7 +1883,7 @@
      * @param request The request we are processing
      * @param locale  The user's selected Locale to be set, or null
      *                to select the server's default Locale
-     * @deprecated Use [EMAIL PROTECTED] #setLocale(java.util.Locale)}.
+     * @deprecated Use [EMAIL PROTECTED] #setLocale(Locale)}.
      */
     protected void setLocale( HttpServletRequest request, Locale locale )
     {
@@ -1822,12 +1897,15 @@
 
     }
 
+    /**
+     * Set the user's currently selected Locale.
+     *
+     * @param locale  The user's selected Locale to be set, or null to select 
the server's default Locale
+     * @deprecated Use [EMAIL PROTECTED] #setLocale(Locale)}.
+     */
     protected void setLocale( Locale locale )
     {
-        if ( locale == null )
-        {
-            locale = getDefaultLocale();
-        }
+        if ( locale == null ) locale = getDefaultLocale();
         getSession().setAttribute( Globals.LOCALE_KEY, locale );
     }
     
@@ -1871,18 +1949,15 @@
         //
         if ( rp == null )
         {
-            if ( rp == null )
+            try
             {
-                try
-                {
-                    ControllerConfig cc = mc.getControllerConfig();
-                    rp = ( RequestProcessor ) 
RequestUtils.applicationInstance( cc.getProcessorClass() );
-                    rp.init( InternalUtils.getActionServlet( 
getServletContext() ), mc );
-                }
-                catch ( Exception e )
-                {
-                    _log.error( "Could not initialize request processor for 
module " + mc.getPrefix(), e );
-                }
+                ControllerConfig cc = mc.getControllerConfig();
+                rp = ( RequestProcessor ) RequestUtils.applicationInstance( 
cc.getProcessorClass() );
+                rp.init( InternalUtils.getActionServlet( getServletContext() 
), mc );
+            }
+            catch ( Exception e )
+            {
+                _log.error( "Could not initialize request processor for module 
" + mc.getPrefix(), e );
             }
         }
         
@@ -1945,5 +2020,10 @@
 
         return PageFlowUtils.getRewrittenActionURI( servletContext, request, 
response,
                                                     actionName, parameters, 
null, asValidXml );
+    }
+    
+    FlowControllerHandlerContext getHandlerContext()
+    {
+        return new FlowControllerHandlerContext( getRequest(), getResponse(), 
this );
     }
 }

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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -201,7 +201,7 @@
     {
         try
         {
-            Class jpfClass = InternalUtils.getReloadableClass( jpfClassName, 
request, servletContext );
+            Class jpfClass = InternalUtils.getReloadableClass( jpfClassName, 
servletContext );
             return getPageFlow( jpfClass, request, response, servletContext );
         }
         catch ( ClassNotFoundException e)
@@ -250,7 +250,7 @@
                                                       HttpServletResponse 
response, ServletContext servletContext )
         throws ClassNotFoundException
     {
-        Class sfClass = InternalUtils.getReloadableClass( sharedFlowClassName, 
request, servletContext );
+        Class sfClass = InternalUtils.getReloadableClass( sharedFlowClassName, 
servletContext );
         return getSharedFlow( sfClass, request, response, servletContext );
     }    
     

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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -24,6 +24,7 @@
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Map;
@@ -36,9 +37,11 @@
 import org.apache.beehive.netui.util.FileUtils;
 import org.apache.beehive.netui.pageflow.config.PageFlowActionForward;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.internal.ContextCache;
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.handler.ReloadableClassHandler;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+
+import org.apache.beehive.netui.pageflow.annotations.Jpf;
 
 
 /**
@@ -53,9 +56,6 @@
     public static final int RETURN_TO_PREVIOUS_PAGE = 2;
     public static final int RETURN_TO_PREVIOUS_ACTION = 3;
     
-    static final int RETURN_TO_PAGE_INTERNAL = -1;      // for internal 
non-deprecated access
-    static final int RETURN_TO_ACTION_INTERNAL = -2;    // for internal 
non-deprecated access
-    
     /**
      * @deprecated Use [EMAIL PROTECTED] #RETURN_TO_CURRENT_PAGE} or [EMAIL 
PROTECTED] #RETURN_TO_PREVIOUS_PAGE} instead.
      */ 
@@ -100,10 +100,10 @@
     private StringBuilder _queryString;
     private boolean _explicitPath = false;
     private String _returnFormType = null;
-    private boolean _userSetRedirect = false;
     private Map _actionOutputs = null;
     private int _returnToType;
-    private boolean _hasExplicitRedirectValue = false;
+    private boolean _redirectSpecifiedOnAnnotation = false;
+    private boolean _redirectSetThroughMethod = false;
     private boolean _restoreQueryString = false;
     private boolean _externalRedirect = false;
     
@@ -128,11 +128,12 @@
         _flowController = init._flowController;
         _servletContext = init._servletContext;
         _returnFormType = init._returnFormType;
-        _userSetRedirect = init._userSetRedirect;
         _actionOutputs = init._actionOutputs;
         _returnToType = init._returnToType;
         _restoreQueryString = init._restoreQueryString;
         _externalRedirect = init._externalRedirect;
+        _redirectSpecifiedOnAnnotation = init._redirectSpecifiedOnAnnotation;
+        _redirectSetThroughMethod = init._redirectSetThroughMethod;
     }
     
     /**
@@ -202,7 +203,10 @@
      */ 
     public Forward( URI path )
     {
-        this( path, false );
+        setPath( path.toString() );
+        setContextRelative( path.getPath().startsWith( "/" ) );
+        if ( path.isAbsolute() ) super.setRedirect( true );
+        _explicitPath = true;
     }
     
     /**
@@ -214,8 +218,13 @@
      */ 
     public Forward( URI path, boolean redirect )
     {
+        if ( ! redirect && path.isAbsolute() )
+        {
+            throw new IllegalStateException( "Redirect value cannot be set to 
false for an absolute URI." );
+        }
+        
         setPath( path.toString() );
-        super.setRedirect( redirect || path.isAbsolute() );
+        setRedirect( redirect );
         setContextRelative( path.getPath().startsWith( "/" ) );
         _explicitPath = true;
     }
@@ -254,7 +263,7 @@
     public void setRedirect( boolean redirect )
     {
         super.setRedirect( redirect );
-        _userSetRedirect = true;
+        _redirectSetThroughMethod = true;
     }
     
     /**
@@ -290,6 +299,10 @@
             _outputForms = new ArrayList();
         }
         
+        //
+        // Throw an exception if this is a redirect, and if there was an 
output form added.  Output forms are carried
+        // in the request, and will be lost on redirects.
+        //
         if ( _init && getRedirect() )
         {
             String actionPath = _mappingPath != null ? _mappingPath : "";
@@ -303,8 +316,7 @@
     }
     
     /**
-     * Get all form-beans attached to this forward through [EMAIL PROTECTED] 
#addOutputForm} or
-     * [EMAIL PROTECTED] #Forward(java.lang.String, java.lang.Object)}.
+     * Get all form-beans attached to this forward through [EMAIL PROTECTED] 
#addOutputForm} or [EMAIL PROTECTED] #Forward(String, Object)}.
      * 
      * @return an array of ActionForm instances that are attached to this 
forward.
      */ 
@@ -314,7 +326,10 @@
         return ( ActionForm[] ) _outputForms.toArray( new ActionForm[0] );
     }
 
-    final ActionForm getFirstOutputForm( HttpServletRequest request )
+    /**
+     * Get the first output form bean that was added to this Forward.
+     */ 
+    public ActionForm getFirstOutputForm( HttpServletRequest request )
     {
         if ( _outputForms == null || _outputForms.size() == 0 )
         {
@@ -328,7 +343,7 @@
                     }
                     
                     ServletContext servletContext = 
InternalUtils.getServletContext( request );
-                    ReloadableClassHandler rch = ContextCache.get( 
servletContext ).getReloadableClassHandler();
+                    ReloadableClassHandler rch = Handlers.get( servletContext 
).getReloadableClassHandler();
                     Object formBean = rch.newInstance( _returnFormType );
                     ActionForm wrappedFormBean = InternalUtils.wrapFormBean( 
formBean );
                     addOutputForm( wrappedFormBean );
@@ -397,8 +412,10 @@
     /**
      * Set an alternate ModuleConfig from which to resolve forwards if they 
are not resolved
      * from the stored ActionMapping (and its stored ModuleConfig).
+     * 
+     * @exclude
      */ 
-    void setAltModuleConfig( ModuleConfig mc )
+    public void setAlternateModuleConfig( ModuleConfig mc )
     {
         _altModuleConfig = mc;
     }
@@ -422,6 +439,10 @@
 
             initFrom( fwd );
             
+            //
+            // Throw an exception if this is a redirect, and if there was an 
output form or an action output added.
+            // Output forms and action outputs are carried in the request, and 
will be lost on redirects.
+            //
             if ( getRedirect() )
             {
                 if ( _actionOutputs != null && ! _actionOutputs.isEmpty() )
@@ -447,10 +468,6 @@
     {
        _path = fwd.getPath();
         
-        if ( ! _userSetRedirect )
-        {
-            setRedirect( fwd.getRedirect() );
-        }
         setContextRelative( fwd.getContextRelative() );
 
         //
@@ -466,7 +483,7 @@
             PageFlowActionForward fc = ( PageFlowActionForward ) fwd;
             _isNestedReturn = fc.isNestedReturn();
             _returnFormType = fc.getReturnFormType();
-            _hasExplicitRedirectValue = fc.hasExplicitRedirectValue();
+            _redirectSpecifiedOnAnnotation = fc.hasExplicitRedirectValue();
             _restoreQueryString = fc.isRestoreQueryString();
             _externalRedirect = fc.isExternalRedirect();
             
@@ -499,7 +516,7 @@
                 }
                 else if ( path.equals( RETURN_TO_PAGE_LEGACY_STR ) )
                 {
-                    _returnToType = RETURN_TO_PAGE_INTERNAL;
+                    _returnToType = RETURN_TO_PAGE;  // legacy
                 }
                 else if ( path.equals( RETURN_TO_PREVIOUS_ACTION_STR ) )
                 {
@@ -507,7 +524,7 @@
                 }
                 else if ( path.equals( RETURN_TO_ACTION_LEGACY_STR ) )
                 {
-                    _returnToType = RETURN_TO_ACTION_INTERNAL;
+                    _returnToType = RETURN_TO_ACTION;  // legacy
                 }
                 else
                 {
@@ -575,6 +592,8 @@
             checkActionOutputs( fc );
         }
         
+        if ( ! _redirectSetThroughMethod ) setRedirect( fwd.getRedirect() );
+        
         _init = true;
     }
 
@@ -665,7 +684,7 @@
      * Set the current ActionMapping and associated FlowController.  Normally, 
this method is called
      * by the framework, but you can use it to initialize the Forward object 
in order to call [EMAIL PROTECTED] #getPath}.
      * 
-     * @deprecated Use [EMAIL PROTECTED] 
#initialize(org.apache.struts.action.ActionMapping, 
org.apache.beehive.netui.pageflow.FlowController, 
javax.servlet.http.HttpServletRequest)} instead.
+     * @deprecated Use [EMAIL PROTECTED] #initialize(ActionMapping, 
FlowController, ServletRequest)} instead.
      * @param mapping the current ActionMapping; this can be obtained from 
[EMAIL PROTECTED] FlowController#getMapping}.
      * @param flowController the object in which to look for referenced 
return-form members.
      */ 
@@ -684,7 +703,7 @@
      * @param mapping the current ActionMapping; this can be obtained from 
[EMAIL PROTECTED] FlowController#getMapping}.
      * @param flowController the object in which to look for referenced 
return-form members.
      */ 
-    public void initialize( ActionMapping mapping, FlowController 
flowController, HttpServletRequest request )
+    public void initialize( ActionMapping mapping, FlowController 
flowController, ServletRequest request )
     {
         _mapping = mapping;
         _mappingPath = mapping != null ? mapping.getPath() : null;
@@ -709,9 +728,15 @@
         return _explicitPath;
     }
     
-    boolean hasExplicitRedirectValue()
+    /**
+     * Tell whether this Forward was configured explicitly (through
+     * [EMAIL PROTECTED] 
org.apache.beehive.netui.pageflow.annotations.Jpf.Forward#redirect}, [EMAIL 
PROTECTED] #setRedirect}), or
+     * [EMAIL PROTECTED] #Forward(URI, boolean)}) to perform a redirect.  
Otherwise, a redirect is implied by a URI that does not
+     * resolve to the current server.
+     */ 
+    public boolean hasExplicitRedirectValue()
     {
-        return _hasExplicitRedirectValue;
+        return _redirectSetThroughMethod || _redirectSpecifiedOnAnnotation;
     }
 
     /**
@@ -754,7 +779,7 @@
     {
         init();
         return _returnToType == RETURN_TO_PREVIOUS_PAGE || _returnToType == 
RETURN_TO_CURRENT_PAGE
-                   || _returnToType == RETURN_TO_PAGE_INTERNAL;
+                   || _returnToType == RETURN_TO_PAGE;
     }
 
     /**
@@ -768,7 +793,7 @@
     public boolean isReturnToAction()
     {
         init();
-        return _returnToType == RETURN_TO_PREVIOUS_ACTION || _returnToType == 
RETURN_TO_ACTION_INTERNAL;
+        return _returnToType == RETURN_TO_PREVIOUS_ACTION || _returnToType == 
RETURN_TO_ACTION;
     }
 
     /**
@@ -788,18 +813,16 @@
         if ( externalRedirect ) setRedirect( true );
     }
 
-    boolean restoreQueryString()
+    /**
+     * Tell whether this Forward will store the original query string on the 
page restored through
+     * [EMAIL PROTECTED] Jpf.NavigateTo#currentPage} or [EMAIL PROTECTED] 
Jpf.NavigateTo#previousPage}.
+     */ 
+    public boolean doesRestoreQueryString()
     {
         init();
         return _restoreQueryString;
     }
     
-    boolean shouldPopPageFlow()
-    {
-        init();
-        return _isNestedReturn;
-    }
-
     /**
      * Tell whether the URI returned by [EMAIL PROTECTED] #getPath} is for a 
page flow.
      * 
@@ -910,6 +933,10 @@
             _actionOutputs = new HashMap();
         }
         
+        //
+        // Throw an exception if this is a redirect, and if there was an 
action output.  Action outputs are carried
+        // in the request, and will be lost on redirects.
+        //
         if ( _init && getRedirect() )
         {
             String actionPath = ( _mappingPath != null ? _mappingPath : "" );
@@ -977,13 +1004,13 @@
             case RETURN_TO_PREVIOUS_PAGE:
                 return RETURN_TO_PREVIOUS_PAGE_STR;
             
-            case RETURN_TO_PAGE_INTERNAL:
+            case RETURN_TO_PAGE:
                 return RETURN_TO_PAGE_LEGACY_STR;
                 
             case RETURN_TO_PREVIOUS_ACTION:
                 return RETURN_TO_PREVIOUS_ACTION_STR;
             
-            case RETURN_TO_ACTION_INTERNAL:
+            case RETURN_TO_ACTION:
                 return RETURN_TO_ACTION_LEGACY_STR;
         }
         

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextListener.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextListener.java?view=diff&r1=149228&r2=149229
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextListener.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowContextListener.java
 Sun Jan 30 22:58:37 2005
@@ -20,10 +20,11 @@
 //java imports
 
 //internal imports
-import org.apache.beehive.netui.pageflow.internal.ContextCache;
 import org.apache.beehive.netui.pageflow.internal.InternalConstants;
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
+import org.apache.beehive.netui.pageflow.internal.LegacySettings;
 import org.apache.beehive.netui.pageflow.util.UrlTemplateDescriptor;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
 import org.apache.beehive.netui.util.config.ConfigUtil;
 import org.apache.beehive.netui.util.config.ConfigInitializationException;
 import org.apache.beehive.netui.util.logging.Logger;
@@ -95,7 +96,8 @@
             throw new IllegalStateException( "Could not initialize from " + 
NETUI_CONFIG_PATH, e );
         }
         
-        ContextCache.init( servletContext );
+        LegacySettings.init( servletContext );
+        Handlers.init( servletContext );
         AdapterManager.initServletContext( servletContext );
         UrlTemplateDescriptor.getInstance().load( servletContext );
     }

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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -509,7 +509,11 @@
         }
     }
     
-    final PreviousPageInfo getPreviousPageInfoLegacy( PageFlowController 
curJpf, HttpServletRequest request )
+    /**
+     * Get a legacy PreviousPageInfo.
+     * @deprecated This method will be removed without replacement in a future 
release.
+     */ 
+    public final PreviousPageInfo getPreviousPageInfoLegacy( 
PageFlowController curJpf, HttpServletRequest request )
     {
         if ( request.getAttribute( RETURNING_FROM_NESTING_ATTR ) != null )
         {
@@ -681,11 +685,12 @@
     }
     
     /**
-     * Called from [EMAIL PROTECTED] FlowController#forwardTo}.
+     * Store information about recent pages displayed.  Usually should not be 
called directly.
+     * @exclude
      */ 
-    void savePreviousPageInfo( ActionForward forward, ActionForm form, 
ActionMapping mapping,
-                               HttpServletRequest request, ServletContext 
servletContext,
-                               boolean isSpecialForward )
+    public void savePreviousPageInfo( ActionForward forward, ActionForm form, 
ActionMapping mapping,
+                                      HttpServletRequest request, 
ServletContext servletContext,
+                                      boolean isSpecialForward )
     {
         if ( forward != null )
         {
@@ -871,8 +876,11 @@
         }
     }
     
-    ActionForward exitNesting( HttpServletRequest request, HttpServletResponse 
response, ActionMapping mapping,
-                               ActionForm form )
+    /**
+     * @exclude
+     */ 
+    public ActionForward exitNesting( HttpServletRequest request, 
HttpServletResponse response, ActionMapping mapping,
+                                      ActionForm form )
     {
         if ( _returnActionViewRenderer != null )
         {

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowEventReporter.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowEventReporter.java?view=diff&r1=149228&r2=149229
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowEventReporter.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowEventReporter.java
 Sun Jan 30 22:58:37 2005
@@ -22,8 +22,8 @@
 import org.apache.struts.action.ActionForward;
 
 import javax.servlet.ServletContext;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletResponse;
+import javax.servlet.ServletRequest;
 
 
 public abstract class PageFlowEventReporter
@@ -36,32 +36,32 @@
     }
     
     public abstract void actionRaised( FlowController flowController, 
ActionMapping mapping, ActionForm form,
-                                       HttpServletRequest request, 
HttpServletResponse response );
+                                       ServletRequest request, ServletResponse 
response );
     
     public abstract void actionSuccess( FlowController flowController, 
ActionMapping mapping, ActionForm form,
-                                        HttpServletRequest request, 
HttpServletResponse response, 
+                                        ServletRequest request, 
ServletResponse response, 
                                         ActionForward result );
     
     public abstract void exceptionRaised( Throwable ex, ActionMapping 
actionMapping, ActionForm form,
-                                          FlowController flowController, 
HttpServletRequest request,
-                                          HttpServletResponse response );
+                                          FlowController flowController, 
ServletRequest request,
+                                          ServletResponse response );
     
     public abstract void exceptionHandled( Throwable ex, ActionMapping 
actionMapping, ActionForm form,
-                                           FlowController flowController, 
HttpServletRequest request,
-                                           HttpServletResponse response, 
ActionForward result );
+                                           FlowController flowController, 
ServletRequest request,
+                                           ServletResponse response, 
ActionForward result );
     
-    public abstract void flowControllerCreated( FlowController flowController, 
HttpServletRequest request,
-                                                HttpServletResponse response );
+    public abstract void flowControllerCreated( FlowController flowController, 
ServletRequest request,
+                                                ServletResponse response );
     
     public abstract void flowControllerDestroyed( FlowController 
flowController );
     
-    public abstract void beginActionRequest( HttpServletRequest request, 
HttpServletResponse response );
+    public abstract void beginActionRequest( ServletRequest request, 
ServletResponse response );
     
-    public abstract void endActionRequest( HttpServletRequest request, 
HttpServletResponse response );
+    public abstract void endActionRequest( ServletRequest request, 
ServletResponse response );
     
-    public abstract void beginPageRequest( HttpServletRequest request, 
HttpServletResponse response );
+    public abstract void beginPageRequest( ServletRequest request, 
ServletResponse response );
     
-    public abstract void endPageRequest( HttpServletRequest request, 
HttpServletResponse response );
+    public abstract void endPageRequest( ServletRequest request, 
ServletResponse response );
     
     protected ServletContext getServletContext()
     {

Modified: 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java
URL: 
http://svn.apache.org/viewcvs/incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java?view=diff&r1=149228&r2=149229
==============================================================================
--- 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java
 (original)
+++ 
incubator/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObjectException.java
 Sun Jan 30 22:58:37 2005
@@ -19,10 +19,13 @@
 
 import org.apache.beehive.netui.util.Bundle;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.beehive.netui.pageflow.internal.RequestValues;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.ServletContext;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
 import java.io.IOException;
 import java.io.PrintWriter;
 
@@ -85,7 +88,7 @@
      * @param request the current HttpServletRequest
      * @param response the current HttpServletResponse
      */    
-    void sendError( HttpServletRequest request, HttpServletResponse response, 
ServletContext servletContext,
+    void sendError( ServletRequest request, ServletResponse response, 
ServletContext servletContext,
                     int productionTimeErrorCode )
         throws IOException
     {
@@ -99,10 +102,11 @@
      * @param request the current HttpServletRequest
      * @param response the current HttpServletResponse
      */    
-    public void sendError( HttpServletRequest request, HttpServletResponse 
response )
+    public void sendError( ServletRequest request, ServletResponse response )
         throws IOException
     {
-        InternalUtils.sendError( _messageKeyPrefix, getMessageArgs(), request, 
response, null );
+        InternalUtils.sendError( _messageKeyPrefix, getMessageArgs(), request, 
response, null,
+                                 RequestValues.avoidDirectResponseOutput( 
request ) );
     }
     
     /**

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?view=diff&r1=149228&r2=149229
==============================================================================
--- 
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
 Sun Jan 30 22:58:37 2005
@@ -313,7 +313,7 @@
             ActionMapping mapping = InternalUtils.getCurrentActionMapping( 
request );
             ActionForm form = InternalUtils.getCurrentActionForm( request );
             ActionForward fwd = fc.handleException( th, mapping, form, 
request, response );
-            fc.getRequestProcessor().processActionForward( request, response, 
fwd );
+            fc.getRequestProcessor().doActionForward( request, response, fwd );
             return true;
         }
         catch ( Throwable t )


Reply via email to