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/03/20 00:42:57 UTC

svn commit: r520178 - in /beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor: InterceptorConfig.java action/ActionInterceptor.java action/SimpleActionInterceptor.java action/SimpleActionInterceptorConfig.java

Author: crogers
Date: Mon Mar 19 16:42:56 2007
New Revision: 520178

URL: http://svn.apache.org/viewvc?view=rev&rev=520178
Log:
Fixed a bogus example entry in the ActionInterceptor Javadoc, add additional Javadoc, and fixed a typo. (BEEHIVE-1183)

Tests: NetUI BVT (WinXP passed)


Modified:
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java
    beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java?view=diff&rev=520178&r1=520177&r2=520178
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/InterceptorConfig.java Mon Mar 19 16:42:56 2007
@@ -25,7 +25,7 @@
 /**
  * <p>
  * Class used to hold configuration information for an {@link Interceptor}.  Each
- * interceptor instance will have it's own configuration object which holds the
+ * interceptor instance will have its own configuration object which holds the
  * interceptor implementation class and a set of custom properties that can be provided
  * for each interceptor instance.
  * </p>
@@ -99,4 +99,4 @@
     {
         _customProperties.put( name, value );
     }
-}
\ No newline at end of file
+}

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java?view=diff&rev=520178&r1=520177&r2=520178
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.java Mon Mar 19 16:42:56 2007
@@ -32,24 +32,40 @@
  *    
  *        &lt;pageflow-action-interceptors&gt;
  *            &lt;global&gt;
- *                &lt;before-action&gt;
- *                    &lt;action-interceptor&gt;
- *                        &lt;interceptor-class&gt;test.BeforeActionInterceptor1&lt;/interceptor-class&gt;
- *                    &lt;/action-interceptor&gt;
- *                    &lt;action-interceptor&gt;
- *                        &lt;interceptor-class&gt;test.BeforeActionInterceptor2&lt;/interceptor-class&gt;
- *                    &lt;/action-interceptor&gt;
- *                    ...
- *                &lt;/before-action&gt;
- *                &lt;after-action&gt;
- *                    &lt;action-interceptor&gt;
- *                        &lt;interceptor-class&gt;test.AfterActionInterceptor1&lt;/interceptor-class&gt;
- *                    &lt;/action-interceptor&gt;
+ *                &lt;action-interceptor&gt;
+ *                    &lt;!-- This interceptor is run before/after ALL page flow actions. --&gt;
+ *                    &lt;interceptor-class&gt;test.GlobalInterceptor&lt;/interceptor-class&gt;
+ *                    &lt;custom-property&gt;
+ *                        &lt;name&gt;someCustomProperty&lt;/name&gt;
+ *                        &lt;value&gt;someValue&lt;/value&gt;
+ *                    &lt;/custom-property&gt;
+ *                &lt;/action-interceptor&gt;
+ *            &lt;/global&gt;
+ *            &lt;per-pageflow&gt;
+ *                &lt;pageflow-uri&gt;/example/intercept/Controller.jpf&lt;/pageflow-uri&gt;
+ *                &lt;!-- These interceptors are run before/after any action in the
+ *                     /example/intercept/Controller.jpf page flow. --&gt;
+ *                &lt;action-interceptor&gt;
+ *                    &lt;interceptor-class&gt;test.ActionInterceptor1&lt;/interceptor-class&gt;
+ *                &lt;/action-interceptor&gt;
+ *                &lt;action-interceptor&gt;
+ *                    &lt;interceptor-class&gt;test.ActionInterceptor2&lt;/interceptor-class&gt;
+ *                &lt;/action-interceptor&gt;
+ *                &lt;per-action&gt;
+ *                    &lt;!-- This interceptor is run before/after the action named
+ *                         &quot;testAction&quot; in the /example/intercept/Controller.jpf
+ *                         page flow. --&gt;
+ *                    &lt;action-name&gt;testAction&lt;/action-name&gt;
  *                    &lt;action-interceptor&gt;
- *                        &lt;interceptor-class&gt;test.AfterActionInterceptor2&lt;/interceptor-class&gt;
+ *                        &lt;interceptor-class&gt;test.ActionInterceptor3&lt;/interceptor-class&gt;
  *                    &lt;/action-interceptor&gt;
- *                &lt;/after-action&gt;
- *            &lt;/global&gt;
+ *                &lt;/per-action&gt;
+ *                ...
+ *            &lt;/per-pageflow&gt;
+ *            &lt;per-pageflow&gt;
+ *                ...
+ *            &lt;/per-pageflow&gt;
+ *            ...
  *        &lt;/pageflow-action-interceptors&gt;
  * 
  *        ...

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java?view=diff&rev=520178&r1=520177&r2=520178
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptor.java Mon Mar 19 16:42:56 2007
@@ -18,12 +18,55 @@
  */
 package org.apache.beehive.netui.pageflow.interceptor.action;
 
-import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
-import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain;
-
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain;
+import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
+
+/**
+ * Derived class for simple Page Flow action interceptors.  The simple interceptors
+ * will override the forward with the given path, either before or after the action.
+ * These are configured in /WEB-INF/beehive-netui-config.xml like this:
+ * <pre>
+ *    &lt;netui-config xmlns="http://beehive.apache.org/netui/2004/server/config"&gt;
+ *        ...
+ *
+ *        &lt;pageflow-action-interceptors&gt;
+ *            ...
+ *            &lt;per-pageflow&gt;
+ *                &lt;pageflow-uri&gt;/example/simpleintercept/Controller.jpf&lt;/pageflow-uri&gt;
+ *                &lt;!-- This interceptor is run before any action in the
+ *                     /example/simpleintercept/Controller.jpf page flow. --&gt;
+ *                &lt;simple-action-interceptorr&gt;
+ *                    &lt;intercept-path&gt;/example/flow/SomeController.java&lt;/intercept-path&gt;
+ *                &lt;/simple-action-interceptor&gt;
+ *            &lt;/per-pageflow&gt;
+ *            &lt;per-pageflow&gt;
+ *                &lt;pageflow-uri&gt;/example/afteraction/Controller.jpf&lt;/pageflow-uri&gt;
+ *                &lt;per-action&gt;
+ *                    &lt;!-- This interceptor is run after the action named
+ *                         &quot;testAction&quot; in the /example/afteraction/Controller.jpf
+ *                         page flow. --&gt;
+ *                    &lt;action-name&gt;testAction&lt;/action-name&gt;
+ *                    &lt;simple-action-intercepto&gt;
+ *                        &lt;intercept-path&gt;/example/flow/SomeController.java&lt;/intercept-path&gt;
+ *                        &lt;after-action&gt;true&lt;/after-action&gt;
+ *                    &lt;/simple-action-intercepto&gt;
+ *                &lt;/per-action&gt;
+ *                ...
+ *            &lt;/per-pageflow&gt;
+ *            &lt;per-pageflow&gt;
+ *                ...
+ *            &lt;/per-pageflow&gt;
+ *            ...
+ *        &lt;/pageflow-action-interceptors&gt;
+ *
+ *        ...
+ *    &lt;/netui-config&gt;
+ *
+ * </pre>
+ */
 class SimpleActionInterceptor
         extends ActionInterceptor
 {
@@ -32,12 +75,40 @@
         init( config );
     }
 
+    /**
+     * Callback invoked before the action is processed.  If the simple interceptor
+     * is configured to run before the action (see {@link SimpleActionInterceptorConfig#isAfterAction}),
+     * this method will override the destination URI with the given intercept path,
+     * and thus prevent the action from running.
+
+     * <p>
+     * Note that {@link InterceptorChain#continueChain} is called to invoke the
+     * rest of the interceptor chain.
+     * </p>
+     *
+     * @param context the current ActionInterceptorContext.
+     * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
+     */
     public void preAction( ActionInterceptorContext context, InterceptorChain chain )
             throws InterceptorException
     {
         if ( ! getActionInterceptorConfig().isAfterAction() ) doit( context, chain );
     }
 
+    /**
+     * Callback invoked after the action is processed.  If the simple interceptor
+     * is configured to run after the action (see {@link SimpleActionInterceptorConfig#isAfterAction}),
+     * this method will change the destination URI using the given intercept path,
+     * and thus override the one returned from the action.
+     *
+     * <p>
+     * Note that {@link InterceptorChain#continueChain} is called to invoke the
+     * rest of the interceptor chain.
+     * </p>
+     *
+     * @param context the current ActionInterceptorContext.
+     * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
+     */
     public void postAction( ActionInterceptorContext context, InterceptorChain chain )
             throws InterceptorException
     {

Modified: beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java
URL: http://svn.apache.org/viewvc/beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java?view=diff&rev=520178&r1=520177&r2=520178
==============================================================================
--- beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java (original)
+++ beehive/trunk/netui/src/pageflow/org/apache/beehive/netui/pageflow/interceptor/action/SimpleActionInterceptorConfig.java Mon Mar 19 16:42:56 2007
@@ -20,6 +20,12 @@
 
 import org.apache.beehive.netui.pageflow.interceptor.InterceptorConfig;
 
+/**
+ * Class used to hold configuration information for an {@link SimpleActionInterceptor}.
+ * Each interceptor instance will have its own configuration object which holds
+ * the destination URI to forward to and whether the interceptor is run after
+ * the action, rather than before.
+ */
 class SimpleActionInterceptorConfig
         extends InterceptorConfig
 {
@@ -33,11 +39,20 @@
         _afterAction = afterAction;
     }
 
+    /**
+     * Get the overriding path or destination URI to forward to.
+     * @return the path to forward to.
+     */
     public String getPath()
     {
         return _path;
     }
 
+    /**
+     * Returns true if the interceptor is run after the action,
+     * rather than before.
+     * @return <code>true</code> if the interceptor is run after the action.
+     */
     public boolean isAfterAction()
     {
         return _afterAction;