You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ri...@apache.org on 2005/08/16 01:11:33 UTC

svn commit: r232905 - in /beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow: SharedFlowController.java internal/InternalUtils.java

Author: rich
Date: Mon Aug 15 16:11:26 2005
New Revision: 232905

URL: http://svn.apache.org/viewcvs?rev=232905&view=rev
Log:
Fix for http://issues.apache.org/jira/browse/BEEHIVE-885 : SharedFlowController is caching its Struts module prefix *per instance*

Also removed a few unused methods from InternalUtils.

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


Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java?rev=232905&r1=232904&r2=232905&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/SharedFlowController.java Mon Aug 15 16:11:26 2005
@@ -17,21 +17,17 @@
 */
 package org.apache.beehive.netui.pageflow;
 
-import org.apache.struts.action.ActionForward;
+import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.pageflow.handler.StorageHandler;
+import org.apache.beehive.netui.pageflow.internal.InternalConstants;
+import org.apache.beehive.netui.util.internal.cache.ClassLevelCache;
 import org.apache.struts.action.ActionForm;
+import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 
+import javax.servlet.ServletContext;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpSession;
-import javax.servlet.ServletContext;
-
-import org.apache.beehive.netui.pageflow.internal.AdapterManager;
-import org.apache.beehive.netui.pageflow.internal.InternalConstants;
-import org.apache.beehive.netui.pageflow.internal.InternalUtils;
-import org.apache.beehive.netui.pageflow.handler.Handlers;
-import org.apache.beehive.netui.pageflow.handler.StorageHandler;
-import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 
 
 /**
@@ -91,7 +87,7 @@
         extends FlowController
         implements PageFlowConstants
 {
-    private transient String _modulePath;
+    private static final String CACHED_INFO_KEY = "cachedInfo";
     
     /**
      * Get the Struts module path for actions in this shared flow.
@@ -100,16 +96,20 @@
      */ 
     public String getModulePath()
     {
-        if ( _modulePath == null )
+        ClassLevelCache cache = ClassLevelCache.getCache( getClass() );
+        String modulePath = ( String ) cache.getCacheObject( CACHED_INFO_KEY );
+        
+        if ( modulePath == null )
         {
             String className = getClass().getName();
             int lastDot = className.lastIndexOf( '.' );
             assert lastDot != -1 : className;
             className = className.substring( 0, lastDot );
-            _modulePath = "/-" + className.replace( '.', '/' );
+            modulePath = "/-" + className.replace( '.', '/' );
+            cache.setCacheObject( CACHED_INFO_KEY, modulePath );
         }
         
-        return _modulePath;
+        return modulePath;
     }
     
     /**

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=232905&r1=232904&r2=232905&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 Mon Aug 15 16:11:26 2005
@@ -645,48 +645,6 @@
         }
     }
     
-    public static String getSharedFlowClassName( HttpServletRequest request, ServletContext servletContext )
-    {
-        return getSharedFlowClassNameForRelativeURI( getDecodedServletPath( request ), request, servletContext );
-    }    
-    
-    public static String getSharedFlowClassNameForRelativeURI( String relativeURI, ServletRequest request,
-                                                               ServletContext servletContext )
-    {
-        String cachedInRequest = ( String ) request.getAttribute( SHARED_FLOW_CLASSNAME_ATTR );
-        if ( cachedInRequest != null ) return cachedInRequest.length() > 0 ? cachedInRequest : null;
-        
-        String parentDir = PageFlowUtils.getModulePathForRelativeURI( relativeURI );
-        String className = null;
-        
-        if ( parentDir.length() > 0 )
-        {
-            assert parentDir.charAt( 0 ) == '/' : parentDir;
-            parentDir = SHARED_FLOW_MODULE_PREFIX + parentDir.substring( 1 );
-            
-            do
-            {
-                className = getFlowControllerClassName( parentDir, request, servletContext );
-                if ( className!= null ) break;
-                int lastSlash = parentDir.lastIndexOf( '/' );
-                parentDir = parentDir.substring( 0, lastSlash );
-            } while ( parentDir.length() > 0 );
-        }
-        
-        if ( className == null ) 
-        {
-            className = getFlowControllerClassName( SHARED_FLOW_ROOT_MODULE, request, servletContext );
-        }
-        
-        if ( className == null ) 
-        {
-            className = getFlowControllerClassName( GLOBALAPP_MODULE_CONTEXT_PATH, request, servletContext );
-        }
-        
-        request.setAttribute( SHARED_FLOW_CLASSNAME_ATTR, className != null ? className : "" );
-        return className;
-    }    
-    
     public static boolean isSharedFlowModule( ModuleConfig mc )
     {
         ControllerConfig cc = mc.getControllerConfig();