You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2007/12/14 02:46:39 UTC

svn commit: r604080 - /beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java

Author: crogers
Date: Thu Dec 13 17:46:37 2007
New Revision: 604080

URL: http://svn.apache.org/viewvc?rev=604080&view=rev
Log:
Overload PageFlowUtils.strutsLookup() to provide an option to set whether processPopulate() routine has already been called (BEEHIVE-1212)

Tests: netui BVT (WinXP passed)


Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?rev=604080&r1=604079&r2=604080&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java Thu Dec 13 17:46:37 2007
@@ -1105,12 +1105,35 @@
         ExpressionMessage msg = new ExpressionMessage( expression, messageArgs );
         InternalUtils.addActionError( propertyName, msg, request );
     }
-    
+
     /**
      * Resolve the given action to a URI by running an entire request-processing cycle on the given ScopedRequest
      * and ScopedResponse.
      * @exclude
-     * 
+     *
+     * @param context the current ServletContext
+     * @param request the ServletRequest, which must be a {@link ScopedRequest}.
+     * @param response the ServletResponse, which must be a {@link ScopedResponse}.
+     * @param actionOverride if not <code>null</code>, this qualified action-path is used to construct an action
+     *                       URI which is set as the request URI.  The action-path <strong>must</strong> begin with '/',
+     *                       which makes it qualified from the webapp root.
+     * @param autoResolveExtensions a list of URI extensions (e.g., ".do", ".jpf") that will be auto-resolved, i.e.,
+     *                              on which this method will be recursively called.  If <code>null</code>, the
+     *                              default extensions ".do" and ".jpf" will be used.
+     */
+    public static ActionResult strutsLookup(ServletContext context, ServletRequest request,
+                                            HttpServletResponse response, String actionOverride,
+                                            String[] autoResolveExtensions)
+        throws Exception
+    {
+        return strutsLookup(context, request, response, actionOverride, autoResolveExtensions, false);
+    }
+
+    /**
+     * Resolve the given action to a URI by running an entire request-processing cycle on the given ScopedRequest
+     * and ScopedResponse.
+     * @exclude
+     *
      * @param context the current ServletContext
      * @param request the ServletRequest, which must be a {@link ScopedRequest}.
      * @param response the ServletResponse, which must be a {@link ScopedResponse}.
@@ -1120,10 +1143,13 @@
      * @param autoResolveExtensions a list of URI extensions (e.g., ".do", ".jpf") that will be auto-resolved, i.e.,
      *                              on which this method will be recursively called.  If <code>null</code>, the
      *                              default extensions ".do" and ".jpf" will be used.
+     * @param processPopulateAlreadyCalled if <code>true</code>, processPopulate() will
+     *                                     not be called for the action form bean.
      */
-    public static ActionResult strutsLookup( ServletContext context, ServletRequest request,
-                                             HttpServletResponse response, String actionOverride,
-                                             String[] autoResolveExtensions )
+    public static ActionResult strutsLookup(ServletContext context, ServletRequest request,
+                                            HttpServletResponse response, String actionOverride,
+                                            String[] autoResolveExtensions,
+                                            boolean processPopulateAlreadyCalled)
         throws Exception
     {
         ScopedRequest scopedRequest = ScopedServletUtils.unwrapRequest( request );
@@ -1164,6 +1190,9 @@
         //
         PageFlowRequestWrapper wrappedRequest = PageFlowRequestWrapper.wrapRequest( ( HttpServletRequest ) request );
         wrappedRequest.setScopedLookup( true );
+        if (processPopulateAlreadyCalled) {
+            wrappedRequest.setProcessPopulateAlreadyCalled(true);
+        }
 
         if (as != null)
         {
@@ -1198,7 +1227,10 @@
                     if ( FileUtils.uriEndsWith( returnURI, autoResolveExtensions[i] ) )
                     {
                         scopedRequest.doForward();
-                        return strutsLookup( context, wrappedRequest, scopedResponse, null, autoResolveExtensions );
+                        return strutsLookup(context, wrappedRequest,
+                                            scopedResponse, null,
+                                            autoResolveExtensions,
+                                            processPopulateAlreadyCalled);
                     }
                 }
             }
@@ -1483,7 +1515,7 @@
             actionURI.append( InternalUtils.getModulePathFromReqAttr( request ) );
             actionURI.append( '/' );
         }
-        
+
         actionURI.append( actionName );
         if ( ! actionName.endsWith( ACTION_EXTENSION ) ) actionURI.append( ACTION_EXTENSION );