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 @@
*
* <pageflow-action-interceptors>
* <global>
- * <before-action>
- * <action-interceptor>
- * <interceptor-class>test.BeforeActionInterceptor1</interceptor-class>
- * </action-interceptor>
- * <action-interceptor>
- * <interceptor-class>test.BeforeActionInterceptor2</interceptor-class>
- * </action-interceptor>
- * ...
- * </before-action>
- * <after-action>
- * <action-interceptor>
- * <interceptor-class>test.AfterActionInterceptor1</interceptor-class>
- * </action-interceptor>
+ * <action-interceptor>
+ * <!-- This interceptor is run before/after ALL page flow actions. -->
+ * <interceptor-class>test.GlobalInterceptor</interceptor-class>
+ * <custom-property>
+ * <name>someCustomProperty</name>
+ * <value>someValue</value>
+ * </custom-property>
+ * </action-interceptor>
+ * </global>
+ * <per-pageflow>
+ * <pageflow-uri>/example/intercept/Controller.jpf</pageflow-uri>
+ * <!-- These interceptors are run before/after any action in the
+ * /example/intercept/Controller.jpf page flow. -->
+ * <action-interceptor>
+ * <interceptor-class>test.ActionInterceptor1</interceptor-class>
+ * </action-interceptor>
+ * <action-interceptor>
+ * <interceptor-class>test.ActionInterceptor2</interceptor-class>
+ * </action-interceptor>
+ * <per-action>
+ * <!-- This interceptor is run before/after the action named
+ * "testAction" in the /example/intercept/Controller.jpf
+ * page flow. -->
+ * <action-name>testAction</action-name>
* <action-interceptor>
- * <interceptor-class>test.AfterActionInterceptor2</interceptor-class>
+ * <interceptor-class>test.ActionInterceptor3</interceptor-class>
* </action-interceptor>
- * </after-action>
- * </global>
+ * </per-action>
+ * ...
+ * </per-pageflow>
+ * <per-pageflow>
+ * ...
+ * </per-pageflow>
+ * ...
* </pageflow-action-interceptors>
*
* ...
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>
+ * <netui-config xmlns="http://beehive.apache.org/netui/2004/server/config">
+ * ...
+ *
+ * <pageflow-action-interceptors>
+ * ...
+ * <per-pageflow>
+ * <pageflow-uri>/example/simpleintercept/Controller.jpf</pageflow-uri>
+ * <!-- This interceptor is run before any action in the
+ * /example/simpleintercept/Controller.jpf page flow. -->
+ * <simple-action-interceptorr>
+ * <intercept-path>/example/flow/SomeController.java</intercept-path>
+ * </simple-action-interceptor>
+ * </per-pageflow>
+ * <per-pageflow>
+ * <pageflow-uri>/example/afteraction/Controller.jpf</pageflow-uri>
+ * <per-action>
+ * <!-- This interceptor is run after the action named
+ * "testAction" in the /example/afteraction/Controller.jpf
+ * page flow. -->
+ * <action-name>testAction</action-name>
+ * <simple-action-intercepto>
+ * <intercept-path>/example/flow/SomeController.java</intercept-path>
+ * <after-action>true</after-action>
+ * </simple-action-intercepto>
+ * </per-action>
+ * ...
+ * </per-pageflow>
+ * <per-pageflow>
+ * ...
+ * </per-pageflow>
+ * ...
+ * </pageflow-action-interceptors>
+ *
+ * ...
+ * </netui-config>
+ *
+ * </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;