You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by do...@apache.org on 2006/02/18 18:17:15 UTC

svn commit: r378742 - in /beehive/trunk/netui/src: pageflow/org/apache/beehive/netui/pageflow/ pageflow/org/apache/beehive/netui/pageflow/faces/internal/ pageflow/org/apache/beehive/netui/pageflow/internal/ tags-html/org/apache/beehive/netui/tags/inter...

Author: dolander
Date: Sat Feb 18 09:17:11 2006
New Revision: 378742

URL: http://svn.apache.org/viewcvs?rev=378742&view=rev
Log:
This checkin removes the public properties which expose internal data structures on the PageFlowController (and base classes).

The new design pattern is to make these getters protected and if there is a required public "getter"
to use "the" instead of "get" as the prefix for the property.  This means that these accessors will
no longer show up as bean properties.

The following properties where changed:
PageFlowController: getSharedFlows(), getCurrentPageInfo(), getPreviousPageInfo(), getPreviousActionInfo()
FolowController: getModuleConfig(), getActions()



Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
    beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java Sat Feb 18 09:17:11 2006
@@ -1001,7 +1001,7 @@
     /**
      * Get the Struts ModuleConfig object associated with this FlowController.
      */
-    public final ModuleConfig getModuleConfig()
+    protected final ModuleConfig getModuleConfig()
     {
         if ( _moduleConfig == null )
         {
@@ -1012,6 +1012,17 @@
     }
 
     /**
+      * This is a non-property public accessor that will return the property value <code>moduleConfig</code>.
+      * This is a non-property method because properties are exposed to databinding and that would expose
+      * internal data structures to attack.
+      * @return the ModuleConfig for this FlowController
+      */
+    public final ModuleConfig theModuleConfig()
+    {
+        return getModuleConfig();
+    }
+
+    /**
      * Gets the Struts module configuration associated with this controller.
      * @deprecated Use {@link #getModuleConfig()} instead.
      * 
@@ -1109,7 +1120,7 @@
      * 
      * @return a String array containing the names of actions handled by methods in this PageFlowController.
      */
-    public String[] getActions()
+    protected String[] getActions()
     {
         ActionConfig[] actionConfigs = getModuleConfig().findActionConfigs();
         ArrayList actionNames = new ArrayList();

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowController.java Sat Feb 18 09:17:11 2006
@@ -332,12 +332,23 @@
      * Get the a map of shared flow name to shared flow instance.
      * @return a Map of shared flow name (string) to shared flow instance ({@link SharedFlowController}).
      */
-    public Map/*< String, SharedFlowController >*/ getSharedFlows()
+    protected Map/*< String, SharedFlowController >*/ getSharedFlows()
     {
         return PageFlowUtils.getSharedFlows( getRequest() );
     }
 
     /**
+      * This is a non-property public accessor that will return the property value <code>sharedFlows</code>.
+      * This is a non-property method because properties are exposed to databinding and that would expose
+      * internal data structures to attack.
+      * @return a Map of shared flow name (string) to shared flow instance ({@link SharedFlowController}).
+      */
+    public final Map theSharedFlows()
+    {
+        return getSharedFlows();
+    }
+
+    /**
      * Get a shared flow, based on its name as defined in this page flow's
      * {@link org.apache.beehive.netui.pageflow.annotations.Jpf.Controller#sharedFlowRefs sharedFlowRefs}
      * attribute on {@link org.apache.beehive.netui.pageflow.annotations.Jpf.Controller &#64;Jpf.Controller}.
@@ -658,7 +669,7 @@
      * @see #getPreviousForwardPath
      * @see #getCurrentForwardPath
      */
-    public final PreviousPageInfo getCurrentPageInfo()
+    protected final PreviousPageInfo getCurrentPageInfo()
     {
         checkPreviousPageInfoDisabled();
 
@@ -671,6 +682,17 @@
         return _currentPageInfo;
     }
 
+   /**
+     * This is a non-property public accessor that will return the property value <code>currrentPageInfo</code>.
+     * This is a non-property method because properties are exposed to databinding and that would expose
+     * internal data structures to attack.
+     * @return a PreviousPageInfo with information about the most recent page shown to the user.
+     */
+    public final PreviousPageInfo theCurrentPageInfo()
+    {
+        return getCurrentPageInfo();
+    }
+
     /**
      * Get information about the previous page (in this page flow) shown to the user.  The previous
      * page is the one shown before the most recent page.
@@ -693,7 +715,7 @@
      * @see #getPreviousForwardPath
      * @see #getCurrentForwardPath
      */
-    public final PreviousPageInfo getPreviousPageInfo()
+    protected final PreviousPageInfo getPreviousPageInfo()
     {
         checkPreviousPageInfoDisabled();
 
@@ -708,6 +730,17 @@
     }
 
     /**
+      * This is a non-property public accessor that will return the property value <code>previousPageInfo</code>.
+      * This is a non-property method because properties are exposed to databinding and that would expose
+      * internal data structures to attack.
+      * @return a PreviousPageInfo with information about the previous page shown to the user.
+      */
+    public final PreviousPageInfo thePreviousPageInfo()
+    {
+        return getPreviousPageInfo();
+    }
+
+    /**
      * Get information about the most recent action run in this page flow.
      * <p>
      * <i>Note: if the current page flow does not use a
@@ -734,11 +767,23 @@
      * @see #getPreviousForwardPath
      * @see #getCurrentForwardPath
      */
-    public final PreviousActionInfo getPreviousActionInfo()
+    protected final PreviousActionInfo getPreviousActionInfo()
     {
         checkPreviousActionInfoDisabled();
         return _previousActionInfo;
     }
+
+    /**
+      * This is a non-property public accessor that will return the property value <code>previousActionInfo</code>.
+      * This is a non-property method because properties are exposed to databinding and that would expose
+      * internal data structures to attack.
+      * @return a PreviousActionInfo with information about the most recent action run in this page flow.
+      */
+    public final PreviousActionInfo thePreviousActionInfo()
+    {
+        return getPreviousActionInfo();
+    }
+
 
     private void checkPreviousActionInfoDisabled()
     {

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/faces/internal/PageFlowViewHandler.java Sat Feb 18 09:17:11 2006
@@ -258,7 +258,7 @@
                 String currentForwardPath = FileUtils.stripFileExtension( curPageFlow.getCurrentForwardPath() );
                 if ( viewID.equals( currentForwardPath ) )
                 {
-                    PreviousPageInfo prevPageInfo = curPageFlow.getCurrentPageInfo();
+                    PreviousPageInfo prevPageInfo = curPageFlow.theCurrentPageInfo();
                     FacesBackingBean backingBean = InternalUtils.getFacesBackingBean( request, servletContext );
                     prevPageInfo.setClientState( new PageClientState( viewRoot, backingBean ) );
                 }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultActionForwardHandler.java Sat Feb 18 09:17:11 2006
@@ -113,12 +113,12 @@
                 switch ( pageFlowFwd.getReturnToType() )
                 {
                     case Forward.RETURN_TO_CURRENT_PAGE:
-                        prevPageInfo = curJpf.getCurrentPageInfo();
+                        prevPageInfo = curJpf.theCurrentPageInfo();
                         isReturnToCurrentPage = true;
                         break;
                         
                     case Forward.RETURN_TO_PREVIOUS_PAGE:
-                        prevPageInfo = curJpf.getPreviousPageInfo();
+                        prevPageInfo = curJpf.thePreviousPageInfo();
                         break;
                     
                     case Forward.RETURN_TO_PAGE:
@@ -127,7 +127,7 @@
                     
                     default:
                         assert false : pageFlowFwd.getReturnToType();
-                        prevPageInfo = curJpf.getCurrentPageInfo();
+                        prevPageInfo = curJpf.theCurrentPageInfo();
                 }
                 
                 fwd =
@@ -411,7 +411,7 @@
             assert false;   // throwPageFlowException() must throw.
         }
                         
-        PreviousActionInfo prevActionInfo = curJpf.getPreviousActionInfo();
+        PreviousActionInfo prevActionInfo = curJpf.thePreviousActionInfo();
         
         if ( prevActionInfo != null )
         {

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/DefaultExceptionsHandler.java Sat Feb 18 09:17:11 2006
@@ -125,7 +125,7 @@
         
         
         // Keep track of the Struts module where we find the exception handler.
-        ModuleConfig moduleConfig = flowController.getModuleConfig();
+        ModuleConfig moduleConfig = flowController.theModuleConfig();
         
         // Callback to the event reporter.
         ActionMapping originalActionMapping = actionMapping;
@@ -160,7 +160,7 @@
             {
                 flowController = fallbackFC;
                 context = new FlowControllerHandlerContext( request, response, flowController );
-                moduleConfig = flowController.getModuleConfig();
+                moduleConfig = flowController.theModuleConfig();
                 exceptionConfig = getExceptionConfig( exClass, moduleConfig );
                 
                 if ( exceptionConfig != null )
@@ -303,7 +303,7 @@
         if ( originalFlowController instanceof PageFlowController )
         {
             Collection/*< SharedFlowController >*/ sharedFlows =
-                    ( ( PageFlowController ) originalFlowController ).getSharedFlows().values();
+                    ( ( PageFlowController ) originalFlowController ).theSharedFlows().values();
             
             for ( Iterator ii = sharedFlows.iterator(); ii.hasNext(); )  
             {
@@ -320,7 +320,7 @@
     
     private boolean checkForExceptionConfig( SharedFlowController sf, Class exClass, ServletRequest request )
     {
-        ModuleConfig mc = sf.getModuleConfig();
+        ModuleConfig mc = sf.theModuleConfig();
         ExceptionConfig ec = getExceptionConfig( exClass, mc );
         
         if ( ec != null )

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java Sat Feb 18 09:17:11 2006
@@ -712,7 +712,7 @@
         //
         // If this is a long-lived page flow, also store the instance in an attribute that never goes away.
         //
-        if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).getModuleConfig() ) )
+        if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).theModuleConfig() ) )
         {
             String longLivedAttrName = getLongLivedFlowAttr( resolver.getModulePath() );
             longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest );

Modified: beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java?rev=378742&r1=378741&r2=378742&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java (original)
+++ beehive/trunk/netui/src/tags-html/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java Sat Feb 18 09:17:11 2006
@@ -193,7 +193,7 @@
                 // It's an action in the current page flow, or in the (deprecated) Global.app.
                 //
                 if (action.charAt(0) != '/') action = '/' + action;
-                mapping = flowController.getModuleConfig().findActionConfig(action);
+                mapping = flowController.theModuleConfig().findActionConfig(action);
                 fc = flowController;
                 
                 //
@@ -203,7 +203,7 @@
                     FlowController globalApp =
                             PageFlowUtils.getSharedFlow(InternalConstants.GLOBALAPP_CLASSNAME, request);
                     if (globalApp != null) {
-                        mapping = globalApp.getModuleConfig().findActionConfig(action);
+                        mapping = globalApp.theModuleConfig().findActionConfig(action);
                         fc = globalApp;
                     }
                 }
@@ -221,7 +221,7 @@
 
                 if (sharedFlow != null) {
                     String actionPath = '/' + action.substring(dot + 1);
-                    mapping = sharedFlow.getModuleConfig().findActionConfig(actionPath);
+                    mapping = sharedFlow.theModuleConfig().findActionConfig(actionPath);
                     fc = sharedFlow;
                 }
             }