You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2006/04/18 00:39:50 UTC

svn commit: r394798 - in /beehive/trunk/netui/src: pageflow/org/apache/beehive/netui/pageflow/ pageflow/org/apache/beehive/netui/pageflow/internal/ tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/ tags-databinding/org/apach...

Author: ekoneil
Date: Mon Apr 17 15:39:48 2006
New Revision: 394798

URL: http://svn.apache.org/viewcvs?rev=394798&view=rev
Log:
NetUI cleanup.  Adding some comments and fixing some things that my IDE complains about.  Also moves a "preventCache" utility method off of the PageFlowPageFilter and onto PageFlowUtils.

BB: self
Test: NetUI pass


Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/FlowController.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowFacesFilter.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowJspFilter.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AdapterManager.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
    beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java
    beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java
    beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ConfigurePager.java
    beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGridUtil.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/AutoRegisterActionServlet.java Mon Apr 17 15:39:48 2006
@@ -81,18 +81,19 @@
      */ 
     public static String MODULE_CONFIG_LOCATOR_CLASS_ATTR = "moduleConfigLocators";
     
+    private static final Logger _log = Logger.getInstance( AutoRegisterActionServlet.class );
+
+    private static final ModuleConfig NONEXISTANT_MODULE_CONFIG = new NonexistantModuleConfig();
+
     /** Map of module-path to ModuleConfig */
-    private Map/*< String, ModuleConfig >*/ _registeredModules = new InternalConcurrentHashMap/*< String, ModuleConfig >*/();
+    private Map/*< String, ModuleConfig >*/ _registeredModules =
+        new InternalConcurrentHashMap/*< String, ModuleConfig >*/();
+
     private transient Digester _cachedConfigDigester = null;
     private Map _configParams = null;
     private ModuleConfigLocator[] _moduleConfigLocators = null;
     private ReloadableClassHandler _rch;
     
-    private static final Logger _log = Logger.getInstance( AutoRegisterActionServlet.class );
-
-    private static final ModuleConfig NONEXISTANT_MODULE_CONFIG = new NonexistantModuleConfig();
-    
-    
     public void init()
         throws ServletException
     {
@@ -112,7 +113,7 @@
         }
         
         //
-        // Look for ModuleConfigLocators in netui-config.xml.
+        // Look for ModuleConfigLocators in beehive-netui-config.xml.
         //
         PageFlowConfig pfConfig = ConfigUtil.getConfig().getPageFlowConfig();
         
@@ -330,8 +331,7 @@
      * is that it does not throw an UnavailableException if a module configuration file is missing or
      * invalid.
      */
-    protected ModuleConfig initModuleConfig
-            ( String prefix, String paths ) throws ServletException
+    protected ModuleConfig initModuleConfig( String prefix, String paths ) throws ServletException
     {
 
         if ( _log.isDebugEnabled() )
@@ -495,7 +495,6 @@
         }
     }
 
-    
     /**
      * Get a resource URL for a module configuration file.  By default, this looks in the ServletContext
      * and in the context classloader.
@@ -807,7 +806,7 @@
     {
         public NonexistantModuleConfig()
         {
-            super( ( String ) null );
+            super( null );
         }
     }
     

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=394798&r1=394797&r2=394798&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 Mon Apr 17 15:39:48 2006
@@ -1321,8 +1321,9 @@
         if ( _maxConcurrentRequestCount == -1 )
         {
             _maxConcurrentRequestCount = DEFAULT_MAX_CONCURRENT_REQUEST_COUNT;
-            String countStr = servletContext.getInitParameter( MAX_CONCURRENT_REQUESTS_PARAM );
+            assert servletContext != null;
 
+            String countStr = servletContext.getInitParameter( MAX_CONCURRENT_REQUESTS_PARAM );
             if ( countStr != null )
             {
                 try
@@ -1350,9 +1351,9 @@
         //
         if ( _requestCount >= _maxConcurrentRequestCount )
         {
-            if ( _log.isDebugEnabled() )
+            if ( _log.isInfoEnabled() )
             {
-                _log.debug( "Too many requests to FlowController " + getDisplayName() + " ("
+                _log.info( "Too many requests to FlowController " + getDisplayName() + " ("
                            + ( _requestCount + 1 ) + '>' + _maxConcurrentRequestCount + "); returning error code "
                            + EXCEEDED_MAX_CONCURRENT_REQUESTS_ERRORCODE );
             }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/Forward.java Mon Apr 17 15:39:48 2006
@@ -17,8 +17,6 @@
  */
 package org.apache.beehive.netui.pageflow;
 
-import org.apache.beehive.netui.util.internal.InternalStringBuilder;
-
 import org.apache.struts.action.ActionForward;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionForm;
@@ -36,15 +34,15 @@
 import java.net.URI;
 import java.net.URL;
 
-import org.apache.beehive.netui.util.logging.Logger;
-import org.apache.beehive.netui.util.internal.FileUtils;
 import org.apache.beehive.netui.pageflow.config.PageFlowActionForward;
 import org.apache.beehive.netui.pageflow.internal.InternalUtils;
 import org.apache.beehive.netui.pageflow.internal.AdapterManager;
 import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
 import org.apache.beehive.netui.pageflow.handler.ReloadableClassHandler;
 import org.apache.beehive.netui.pageflow.handler.Handlers;
-
+import org.apache.beehive.netui.util.internal.FileUtils;
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
+import org.apache.beehive.netui.util.logging.Logger;
 
 /**
  * An object of this type is returned from an action methods in a {@link PageFlowController} to
@@ -436,7 +434,7 @@
         _altModuleConfig = mc;
     }
     
-    private final void init()
+    private void init()
     {
         if ( ! _init )
         {

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowFacesFilter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowFacesFilter.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowFacesFilter.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowFacesFilter.java Mon Apr 17 15:39:48 2006
@@ -22,7 +22,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-
 /**
  * Servlet Filter for JavaServer Faces requests.
  */ 

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowJspFilter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowJspFilter.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowJspFilter.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowJspFilter.java Mon Apr 17 15:39:48 2006
@@ -20,7 +20,6 @@
 import java.util.HashSet;
 import java.util.Set;
 
-
 /**
  * Servlet Filter for JSP requests.
  */ 

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowManagedObject.java Mon Apr 17 15:39:48 2006
@@ -34,7 +34,7 @@
  * Base class for Page Flow managed objects (like page flows and JavaServer Faces backing beans).
  */ 
 public abstract class PageFlowManagedObject
-        implements Serializable, HttpSessionBindingListener
+    implements Serializable, HttpSessionBindingListener
 {
     private static final Logger _log = Logger.getInstance( PageFlowManagedObject.class );
     
@@ -243,5 +243,16 @@
     public long getCreateTime()
     {
         return _createTime;
+    }
+
+    /**
+     * Package protected getter that provides access to a read-only property about the current state
+     * of this Page Flow.  If it has been destroyed in the middle of a request, this flag will return
+     * <code>true</code> and <code>false</code> otherwise.
+     *
+     * @return <code>true</code> if this object has been destroyed; <code>false</code> otherwise.
+     */
+    boolean isDestroyed() {
+        return _isDestroyed;
     }
 }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowPageFilter.java Mon Apr 17 15:39:48 2006
@@ -17,11 +17,28 @@
 */
 package org.apache.beehive.netui.pageflow;
 
+import java.io.IOException;
+import java.util.Map;
+import java.util.Set;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.ServletContext;
+import javax.servlet.ServletException;
+import javax.servlet.FilterConfig;
+import javax.servlet.Filter;
+import javax.servlet.ServletRequest;
+import javax.servlet.FilterChain;
+import javax.servlet.ServletResponse;
+
 import org.apache.beehive.netui.core.urls.URLRewriterService;
 import org.apache.beehive.netui.core.urls.TemplatedURLFormatter;
 import org.apache.beehive.netui.core.urltemplates.URLTemplatesFactory;
 import org.apache.beehive.netui.pageflow.handler.Handlers;
-import org.apache.beehive.netui.pageflow.internal.*;
+import org.apache.beehive.netui.pageflow.internal.AdapterManager;
+import org.apache.beehive.netui.pageflow.internal.PageFlowInitialization;
+import org.apache.beehive.netui.pageflow.internal.InternalUtils;
+import org.apache.beehive.netui.pageflow.internal.DefaultURLRewriter;
+import org.apache.beehive.netui.pageflow.internal.PageFlowRequestWrapper;
 import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
 import org.apache.beehive.netui.util.internal.FileUtils;
 import org.apache.beehive.netui.util.internal.ServletUtils;
@@ -34,18 +51,11 @@
 import org.apache.struts.util.MessageResources;
 import org.apache.struts.util.RequestUtils;
 
-import javax.servlet.*;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-
 /**
- * Base class for Servlet Filters that run before Page Flow page requests.
+ * Base class for Servlet Filters that run before requests for JSP pages in a Page Flow enabled web application.
  */
-public abstract class PageFlowPageFilter implements Filter
+public abstract class PageFlowPageFilter
+    implements Filter
 {
     private ServletContext _servletContext;
     private ServletContainerAdapter _servletContainerAdapter;
@@ -53,9 +63,6 @@
 
     private static final Logger _log = Logger.getInstance( PageFlowPageFilter.class );
 
-    private static final String PREVENT_CACHE_ATTR = InternalConstants.ATTR_PREFIX + "preventCache";
-
-
     protected PageFlowPageFilter()
     {
     }
@@ -81,8 +88,6 @@
         _flowControllerFactory = FlowControllerFactory.get( _servletContext );
     }
 
-    protected abstract Set getValidFileExtensions();
-
     public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
             throws IOException, ServletException
     {
@@ -122,13 +127,15 @@
                 return;
             }
 
-            if ( _log.isDebugEnabled() ) _log.debug( "Filtering request for path " + servletPath );
+            if ( _log.isDebugEnabled() )
+                _log.debug( "Filtering request for path " + servletPath );
 
             //
             // If at an earlier stage in the request we determined that we should prevent caching,
             // actually write the appropriate headers to the response now.
             //
-            if ( request.getAttribute( PREVENT_CACHE_ATTR ) != null ) ServletUtils.preventCache( httpResponse );
+            if ( PageFlowUtils.isPreventCache(request) )
+                ServletUtils.preventCache( httpResponse );
 
             //
             // Initialize the ServletContext in the request.  Often, we need access to the ServletContext when we only
@@ -163,13 +170,14 @@
 
             PageFlowRequestWrapper rw = PageFlowRequestWrapper.unwrap( request );
             boolean isForwardedRequest = rw != null && rw.isForwardedRequest();
-            
+
             try
             {
                 ModuleConfig prevModuleConfig = RequestUtils.getRequestModuleConfig( httpRequest );
                 MessageResources prevMessageResources = ( MessageResources ) request.getAttribute( Globals.MESSAGES_KEY );
-                if ( rw == null || ! rw.isStayInCurrentModule() ) initializeModule( httpRequest, httpResponse );
-                
+                if ( rw == null || ! rw.isStayInCurrentModule() )
+                    initializeModule( httpRequest );
+
                 try
                 {
                     //
@@ -179,7 +187,7 @@
                             _flowControllerFactory.getSharedFlowsForRequest( requestContext );
                     ImplicitObjectUtil.loadSharedFlow( request, sharedFlows );
                     ImplicitObjectUtil.loadGlobalApp( request, PageFlowUtils.getGlobalApp( httpRequest ) );
-                    
+
                     //
                     // Make sure that the current PageFlowController is set up for this request.
                     //
@@ -193,7 +201,7 @@
                     {
                         curJpf = _flowControllerFactory.getPageFlowForRequest( requestContext );
                     }
-                    
+
                     //
                     // If there is no pageflow for the current Struts module, than fall back to default
                     // Struts behavior, which is *not* to allow a page request to set the current module.
@@ -203,14 +211,13 @@
                         InternalUtils.setCurrentModule( prevModuleConfig, request );
                         request.setAttribute( Globals.MESSAGES_KEY, prevMessageResources );
                     }
-                    
-                    
+
                     if ( _log.isDebugEnabled() )
                     {
                         _log.debug( "Current PageFlowController is: " + curJpf );
                         _log.debug( "Continuing with filter chain..." );
                     }
-                    
+
                     runPage( curJpf, httpRequest, httpResponse, chain );
                 }
                 catch ( ClassNotFoundException e )
@@ -234,7 +241,7 @@
                 _servletContainerAdapter.endRequest( httpRequest, httpResponse );
                 long timeTaken = System.currentTimeMillis() - startTime;
                 er.endPageRequest( requestContext, timeTaken );
-                
+
                 //
                 // If this is not a forwarded request, then commit any session-scoped changes that were stored in the
                 // request.
@@ -250,8 +257,18 @@
             continueChainNoWrapper( request, response, chain );
         }
     }
-    
-    private void runPage( PageFlowController curJpf, HttpServletRequest request, HttpServletResponse response,
+
+    public void destroy()
+    {
+        _servletContext = null;
+    }
+
+    /* todo: why is this here?  the valid file extensions are set in web.xml, so why reset them? */
+    protected abstract Set getValidFileExtensions();
+
+    private void runPage( PageFlowController curJpf,
+                          HttpServletRequest request,
+                          HttpServletResponse response,
                           FilterChain chain )
         throws IOException, ServletException
     {
@@ -273,7 +290,7 @@
                 {
                     //
                     // Any databinding calls, indirect calls to getRequest(), etc. must be protected
-                    // against conflicts from running action methods at the same time as rendering 
+                    // against conflicts from running action methods at the same time as rendering
                     // the page here.  Synchronize on the JPF.
                     //
                     synchronized ( curJpf )
@@ -287,13 +304,13 @@
                                 new FlowController.PerRequestState( request, response, null );
                         FlowController.PerRequestState prevState = curJpf.setPerRequestState( newState );
                         ImplicitObjectUtil.loadImplicitObjects( request, response, _servletContext, curJpf );
-                                
+
                         //
                         // Tell the page flow that we're about to display a page so it can manage settings,
                         // such as previous page information, if needed in advance.
                         //
                         curJpf.beforePage();
-                                
+
                         try
                         {
                             chain.doFilter( request, response );
@@ -351,10 +368,8 @@
         // Remove our request wrapper -- the page doesn't need to see this.
         //
         if ( request instanceof PageFlowRequestWrapper )
-        {
-            request = ( ( PageFlowRequestWrapper ) request ).getHttpRequest();
-        }
-        
+            request = ((PageFlowRequestWrapper)request).getHttpRequest();
+
         chain.doFilter( request, response );
     }
     
@@ -371,13 +386,13 @@
         }
         catch ( Throwable t )
         {
-            _log.error( "Exception while handling exception " + th.getClass().getName()
-                        + ".  The original exception will be thrown.", th );
+            _log.error("Exception while handling exception " + th.getClass().getName()
+                + ".  The original exception will be thrown.  Cause: " + t, t);
             return false;
         }
     } 
     
-    private void initializeModule( HttpServletRequest request, HttpServletResponse response )
+    private void initializeModule( HttpServletRequest request)
     {
         //
         // Ensure that the right Struts module is selected, for use by the tags.
@@ -385,20 +400,5 @@
         String curModulePath = PageFlowUtils.getModulePath( request );
         InternalUtils.ensureModuleConfig( curModulePath, _servletContext );
         InternalUtils.selectModule( curModulePath, request, _servletContext );
-    }
-    
-    /**
-     * Make sure that when this page is rendered, it will set headers in the response to prevent caching.
-     * Because these headers are lost on server forwards, we set a request attribute to cause the headers
-     * to be set right before the page is rendered.
-     */ 
-    static void preventCache( HttpServletRequest request )
-    {
-        request.setAttribute( PREVENT_CACHE_ATTR, Boolean.TRUE );
-    }
-    
-    public void destroy()
-    {
-        _servletContext = null;
     }
 }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowRequestProcessor.java Mon Apr 17 15:39:48 2006
@@ -17,9 +17,6 @@
  */
 package org.apache.beehive.netui.pageflow;
 
-import org.apache.beehive.netui.util.internal.InternalStringBuilder;
-import org.apache.beehive.netui.util.internal.ServletUtils;
-
 import org.apache.beehive.netui.core.urls.URLRewriterService;
 import org.apache.beehive.netui.core.urls.TemplatedURLFormatter;
 import org.apache.beehive.netui.core.urltemplates.URLTemplatesFactory;
@@ -42,8 +39,11 @@
 import org.apache.beehive.netui.pageflow.scoping.ScopedRequest;
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.script.common.ImplicitObjectUtil;
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
 import org.apache.beehive.netui.util.internal.DiscoveryUtils;
 import org.apache.beehive.netui.util.internal.FileUtils;
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
+import org.apache.beehive.netui.util.internal.ServletUtils;
 import org.apache.beehive.netui.util.config.ConfigUtil;
 import org.apache.beehive.netui.util.config.bean.PageFlowConfig;
 import org.apache.beehive.netui.util.config.bean.PreventCache;
@@ -87,9 +87,6 @@
 import java.net.URISyntaxException;
 import java.util.*;
 
-import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
-
-
 /**
  * The Page Flow extension of the Struts RequestProcessor, which contains callbacks that are invoked
  * during processing of a request to the Struts action servlet.  This class is registered as the
@@ -510,6 +507,7 @@
             RequestContext requestContext = new RequestContext( request, response );
             Map/*< String, SharedFlowController >*/ sharedFlows =
                     _flowControllerFactory.getSharedFlowsForRequest( requestContext );
+
             /* todo: why are the shared flow / global app objects loaded for data binding here? */
             ImplicitObjectUtil.loadSharedFlow( request, sharedFlows );
             ImplicitObjectUtil.loadGlobalApp( request, PageFlowUtils.getGlobalApp( request ) );
@@ -777,8 +775,9 @@
         if ( _log.isTraceEnabled() )
         {
             localRequestCount = ++requestNumber;
-            _log.trace( "------------------------------- Start Request #" + localRequestCount
-                       + " -----------------------------------" );
+            _log.trace( "------------------------------- Start Request #" +
+                localRequestCount +
+                " -----------------------------------" );
         }
 
         //
@@ -788,7 +787,7 @@
         _handlers.getReloadableClassHandler().reloadClasses( new RequestContext( request, response ) );
 
         //
-        // Go through the chain of pre-request interceptors.
+        // Get the chain of pre-request interceptors.
         //
         RequestInterceptorContext context = new RequestInterceptorContext( request, response, getServletContext() );
         List/*< Interceptor >*/ interceptors = context.getRequestInterceptors();
@@ -886,8 +885,9 @@
 
         if ( _log.isTraceEnabled() )
         {
-            _log.trace( "-------------------------------- End Request #" + localRequestCount
-                       + " ------------------------------------" );
+            _log.trace( "-------------------------------- End Request #" +
+                localRequestCount +
+                " ------------------------------------" );
         }
     }
 
@@ -947,7 +947,7 @@
         return REDIRECT_REQUEST_ATTRS_PREFIX + hash + webappRelativeURI;
     }
 
-    private static final void rethrowUnhandledException( UnhandledException ex )
+    private static void rethrowUnhandledException( UnhandledException ex )
         throws ServletException
     {
         Throwable rootCause = ex.getRootCause();
@@ -2010,11 +2010,11 @@
         {
             //
             // The call to PageFlowPageFilter.preventCache() will cause caching to be prevented
-            // even when we end up forwarding to a pagee.  Normally, no-cache headers are lost
+            // even when we end up forwarding to a page.  Normally, no-cache headers are lost
             // when a server forward occurs.
             //
             ServletUtils.preventCache( response );
-            PageFlowPageFilter.preventCache( request );
+            PageFlowUtils.setPreventCache( request );
         }
     }
     

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/PageFlowUtils.java?rev=394798&r1=394797&r2=394798&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 Mon Apr 17 15:39:48 2006
@@ -17,8 +17,6 @@
  */
 package org.apache.beehive.netui.pageflow;
 
-import org.apache.beehive.netui.util.internal.InternalStringBuilder;
-
 import org.apache.beehive.netui.core.urls.FreezableMutableURI;
 import org.apache.beehive.netui.core.urls.MutableURI;
 import org.apache.beehive.netui.core.urls.URIContext;
@@ -37,8 +35,10 @@
 import org.apache.beehive.netui.pageflow.scoping.ScopedServletUtils;
 import org.apache.beehive.netui.pageflow.handler.StorageHandler;
 import org.apache.beehive.netui.pageflow.handler.Handlers;
+import org.apache.beehive.netui.util.internal.InternalStringBuilder;
 import org.apache.beehive.netui.util.internal.FileUtils;
 import org.apache.beehive.netui.util.internal.ServletUtils;
+import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
 import org.apache.beehive.netui.util.config.ConfigUtil;
 import org.apache.beehive.netui.util.config.bean.UrlConfig;
 import org.apache.beehive.netui.util.logging.Logger;
@@ -66,10 +66,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.beehive.netui.util.internal.concurrent.InternalConcurrentHashMap;
-
-
-
 /**
  * Utility methods related to Page Flow.
  */ 
@@ -78,16 +74,15 @@
 {
     private static final Logger _log = Logger.getInstance( PageFlowUtils.class );
 
+    private static final String PREVENT_CACHE_ATTR = InternalConstants.ATTR_PREFIX + "preventCache";
     private static final String ACTION_URI_ATTR = ATTR_PREFIX + "_actionURI";
     private static final int    PAGEFLOW_EXTENSION_LEN = PAGEFLOW_EXTENSION.length();
     private static final String DEFAULT_AUTORESOLVE_EXTENSIONS[] = new String[]{ ACTION_EXTENSION, PAGEFLOW_EXTENSION };
     
-    
     /** Map of Struts module prefix to Map of form-type-name to form-name. */
     private static Map/*< String, Map< String, List< String > > >*/ _formNameMaps =
             new InternalConcurrentHashMap/*< String, Map< String, List< String > > >*/();
 
-    
     /**
      * Get the Struts module path for a URI.  This is the parent directory, relative to the web
      * application root, of the file referenced by the URI.
@@ -136,7 +131,7 @@
      * @param relativeTo a PageFlowController to which the returned URI should be relative, or
      *        <code>null</code> if the returned URI should be relative to the webapp root.
      */
-    public static final String getRelativeURI( HttpServletRequest request, PageFlowController relativeTo )
+    public static String getRelativeURI( HttpServletRequest request, PageFlowController relativeTo )
     {
         if ( relativeTo == null ) return InternalUtils.getDecodedServletPath( request );
         return getRelativeURI( request, InternalUtils.getDecodedURI( request ), relativeTo );
@@ -150,7 +145,7 @@
      * @param relativeTo a PageFlowController to which the returned URI should be relative, or
      *        <code>null</code> if the returned URI should be relative to the webapp root.
      */
-    public static final String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
+    public static String getRelativeURI( HttpServletRequest request, String uri, PageFlowController relativeTo )
     {
         String contextPath = request.getContextPath();
         if ( relativeTo != null ) contextPath += relativeTo.getModulePath();
@@ -190,7 +185,7 @@
      * @param request the current HttpServletRequest
      * @return a {@link PageFlowStack} of nested page flows ({@link PageFlowController}s) for the current user session.
      */
-    public static final Stack getPageFlowStack( HttpServletRequest request )
+    public static Stack getPageFlowStack( HttpServletRequest request )
     {
         ServletContext servletContext = InternalUtils.getServletContext( request );
         return PageFlowStack.get( request, servletContext, true ).getLegacyStack();
@@ -251,7 +246,7 @@
      * @param servletContext the current ServletContext.
      * @return the current PageFlowController from the user session, or <code>null</code> if there is none.
      */ 
-    public static final PageFlowController getCurrentPageFlow( HttpServletRequest request, ServletContext servletContext )
+    public static PageFlowController getCurrentPageFlow( HttpServletRequest request, ServletContext servletContext )
     {
         ActionResolver cur = getCurrentActionResolver( request, servletContext );
 
@@ -273,7 +268,7 @@
      * @return the current PageFlowController from the user session, or <code>null</code>
      *         if there is none.
      */ 
-    public static final PageFlowController getCurrentPageFlow( HttpServletRequest request )
+    public static PageFlowController getCurrentPageFlow( HttpServletRequest request )
     {
         ActionResolver cur = getCurrentActionResolver( request );
         return cur != null && cur.isPageFlow() ? ( PageFlowController ) cur : null;
@@ -1722,5 +1717,29 @@
         }
 
         return factory;
+    }
+
+    /**
+     * Make sure that when this page is rendered, it will set headers in the response to prevent caching.
+     * Because these headers are lost on server forwards, we set a request attribute to cause the headers
+     * to be set right before the page is rendered.  This attribute can be read via
+     * {@link #isPreventCache(javax.servlet.ServletRequest)}.
+     *
+     * @param request the servlet request
+     */
+    static void setPreventCache( ServletRequest request ) {
+        assert request != null;
+        request.setAttribute(PREVENT_CACHE_ATTR, Boolean.TRUE);
+    }
+
+    /**
+     * Internal getter that reports whether this request should prevent caching.  This flag is set via the
+     * {@link #setPreventCache(javax.servlet.ServletRequest)} attribute.
+     * @param request the servlet request
+     * @return <code>true</code> if the framework has set the prevent cache flag
+     */
+    static boolean isPreventCache(ServletRequest request) {
+        assert request != null;
+        return request.getAttribute(PREVENT_CACHE_ATTR) != null;
     }
 }

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AdapterManager.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AdapterManager.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AdapterManager.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AdapterManager.java Mon Apr 17 15:39:48 2006
@@ -113,26 +113,6 @@
         return null;
     }
 
-    /*
-    private static Class loadClass( ClassLoaders classLoaders, String className, Class spiClass )
-    {
-        for ( int i = 0; i < classLoaders.size(); ++i )
-        {
-            try
-            {
-                return classLoaders.get( i ).loadClass( className );
-            }
-            catch ( ClassNotFoundException e )
-            {
-                // ignore
-            }
-        }
-        
-        _log.error( "Could not load class " + className + " to implement " + spiClass.getName() );
-        return null;
-    }
-    */
-    
     private static ServletContainerAdapter createServletContainerAdapter( ServletContext servletContext )
     {
         String adapterClassName = System.getProperty( SERVLET_CONTAINER_ADAPTER_PROP );
@@ -149,25 +129,6 @@
                 if ( sa != null ) return sa;
             }
         }
-
-        /*
-        ClassLoaders loaders = ClassLoaders.getAppLoaders( ServletContainerAdapter.class, AdapterManager.class, true );
-        DiscoverServiceNames dsn = new DiscoverServiceNames( loaders );
-        ResourceNameIterator i = dsn.findResourceNames( ServletContainerAdapter.class.getName() );
-        
-        while ( i.hasNext() )
-        {
-            Class adapterClass = loadClass( loaders, i.nextResourceName(), ServletContainerAdapter.class );
-            
-            if ( adapterClass != null )
-            {
-                ServletContainerAdapter sa =
-                        ( ServletContainerAdapter ) tryAdapter( adapterClass, servletContext );
-                if ( sa != null ) return sa;
-            }
-        }
-        
-        */
         
         Class[] classes = DiscoveryUtils.getImplementorClasses( ServletContainerAdapter.class );
         

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/internal/AnnotationReader.java Mon Apr 17 15:39:48 2006
@@ -34,7 +34,8 @@
 import java.util.Map;
 
 /**
- * Utility for reading XML files that describe annotations in classes.  These files are generated during Page Flow build.
+ * Utility for reading XML files that describe annotations in classes.  These files are generated during
+ * Page Flow build.
  */
 public class AnnotationReader
         implements Serializable

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=394798&r1=394797&r2=394798&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 Apr 17 15:39:48 2006
@@ -64,8 +64,6 @@
 import java.util.Map;
 import java.util.Locale;
 
-
-
 public class InternalUtils
         implements PageFlowConstants, InternalConstants
 {
@@ -698,7 +696,8 @@
         StorageHandler sh = Handlers.get( servletContext ).getStorageHandler();
         HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
         RequestContext rc = new RequestContext( unwrappedRequest, null );
-        String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
+        String currentJpfAttrName =
+            ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest );
         String currentLongLivedJpfAttrName =
                 ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest );
 

Modified: beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java (original)
+++ beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/api/rendering/DataGridTagModel.java Mon Apr 17 15:39:48 2006
@@ -191,8 +191,6 @@
             default:
                 throw new IllegalStateException(Bundle.getErrorString("DataGridTagModel_InvalidStateTransition"));
         }
-
-        return;
     }
 
     /**

Modified: beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java (original)
+++ beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/databinding/datagrid/runtime/util/JspUtil.java Mon Apr 17 15:39:48 2006
@@ -48,7 +48,7 @@
      * @return the {@link HttpServletRequest}
      * @throws IllegalStateException if the {@link JspContext} is unable to provide a {@link HttpServletRequest}
      */
-    public static final HttpServletRequest getRequest(JspContext jspContext) {
+    public static HttpServletRequest getRequest(JspContext jspContext) {
         PageContext pageContext = getPageContext(jspContext);
         return (HttpServletRequest)pageContext.getRequest();
     }
@@ -59,7 +59,7 @@
      * @return the page context
      * @throws IllegalStateException if the {@link JspContext} can't be converted into a {@link PageContext}
      */
-    public static final PageContext getPageContext(JspContext jspContext) {
+    public static PageContext getPageContext(JspContext jspContext) {
         if(!(jspContext instanceof PageContext))
             throw new IllegalStateException(Bundle.getErrorString("DataGridUtil_IllegalJspContext", new Object[]{(jspContext != null ? jspContext.getClass().getName() : "null")}));
         else
@@ -80,7 +80,7 @@
      * @return a URL represented as a string.  This URL will be correctly encoded by calling {@link HttpServletResponse#encodeURL(String)}
      * @throws URISyntaxException
      */
-    public static final String createURL(String href, String action, String location, String scope, Map params, JspContext jspContext)
+    public static String createURL(String href, String action, String location, String scope, Map params, JspContext jspContext)
             throws URISyntaxException {
         PageContext pageContext = getPageContext(jspContext);
 
@@ -111,7 +111,7 @@
      * @param jspContext the jsp context
      * @return the current locale
      */
-    public static final Locale getLocale(JspContext jspContext) {
+    public static Locale getLocale(JspContext jspContext) {
         return InternalUtils.lookupLocale(jspContext);
     }
 }

Modified: beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ConfigurePager.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ConfigurePager.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ConfigurePager.java (original)
+++ beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/ConfigurePager.java Mon Apr 17 15:39:48 2006
@@ -278,7 +278,7 @@
 
         if(_pageHref == null && _pageAction == null) {
             LOGGER.info("The configurePager tag has no page action or HREF specified; using the current request URI instead.");
-            _pageHref = ((HttpServletRequest)JspUtil.getRequest(getJspContext())).getRequestURI();
+            _pageHref = JspUtil.getRequest(getJspContext()).getRequestURI();
         }
 
         if(_pageHref != null)

Modified: beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGridUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGridUtil.java?rev=394798&r1=394797&r2=394798&view=diff
==============================================================================
--- beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGridUtil.java (original)
+++ beehive/trunk/netui/src/tags-databinding/org/apache/beehive/netui/tags/databinding/datagrid/DataGridUtil.java Mon Apr 17 15:39:48 2006
@@ -40,7 +40,7 @@
      * @param jspContext the jsp context
      * @return the {@link DataGridTagModel} if one is found
      */
-    public static final DataGridTagModel getDataGridTagModel(JspContext jspContext) {
+    public static DataGridTagModel getDataGridTagModel(JspContext jspContext) {
         Object model = jspContext.getAttribute(KEY_GRID_MODEL);
         assert model != null ? model instanceof DataGridTagModel : true;
         return (DataGridTagModel)model;
@@ -52,7 +52,7 @@
      * @param jspContext the jsp context
      * @param dataGridTagModel the {@link DataGridTagModel}
      */
-    public static final void putDataGridTagModel(JspContext jspContext, DataGridTagModel dataGridTagModel) {
+    public static void putDataGridTagModel(JspContext jspContext, DataGridTagModel dataGridTagModel) {
         jspContext.setAttribute(KEY_GRID_MODEL, dataGridTagModel);
     }
 
@@ -60,7 +60,7 @@
      * Remove a {@link DataGridTagModel} from the {@link JspContext}
      * @param jspContext the jsp context
      */
-    public static final void removeDataGridTagModel(JspContext jspContext) {
+    public static void removeDataGridTagModel(JspContext jspContext) {
         jspContext.removeAttribute(KEY_GRID_MODEL);
     }
 
@@ -70,7 +70,7 @@
      * @param jspContext the jsp context
      * @return the {@link CellModel} if one is found
      */
-    public static final CellModel getCellModel(JspContext jspContext) {
+    public static CellModel getCellModel(JspContext jspContext) {
         Object model = jspContext.getAttribute(KEY_CELL_MODEL);
         assert model != null ? model instanceof CellModel : true;
         return (CellModel)model;
@@ -82,7 +82,7 @@
      * @param jspContext the jsp context
      * @param cellModel the {@link CellModel}
      */
-    public static final void putCellModel(JspContext jspContext, CellModel cellModel) {
+    public static void putCellModel(JspContext jspContext, CellModel cellModel) {
         jspContext.setAttribute(KEY_CELL_MODEL, cellModel);
     }
 
@@ -90,7 +90,7 @@
      * Remove a {@link CellModel} from the {@link JspContext}
      * @param jspContext the jsp context
      */
-    public static final void removeCellModel(JspContext jspContext) {
+    public static void removeCellModel(JspContext jspContext) {
         jspContext.removeAttribute(KEY_CELL_MODEL);
     }
 }