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 16:13:41 UTC

svn commit: r520421 - in /beehive/trunk/docs/forrest/release/src/documentation/content/xdocs: netui/actionInterceptors.xml netui/samples/index.xml site.xml

Author: crogers
Date: Tue Mar 20 08:13:40 2007
New Revision: 520421

URL: http://svn.apache.org/viewvc?view=rev&rev=520421
Log:
Created additional documentation describing action interceptors. (BEEHIVE-1177)

Tests: ran build.dist and checked the documents


Added:
    beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml   (with props)
Modified:
    beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/samples/index.xml
    beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml

Added: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml?view=auto&rev=520421
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml (added)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml Tue Mar 20 08:13:40 2007
@@ -0,0 +1,185 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
+<document>
+    <header>
+        <title>Action Interceptors</title>
+    </header>
+    <body>
+        <section id="introduction">
+            <title>Introduction</title>
+            <p>
+                Sometimes it's useful to be able to run code before and/or
+                after an action executes. NetUI includes a feature to
+                configure "action interceptor" classes to run before/after
+                all actions, a particular action, or all actions in a particular
+                page flow. The action interceptor can change or cancel the
+                destination URI, throw an exception, or "inject" an entire
+                nested page flow to run before the action.
+            </p>
+            <p>
+                A simple example of this would be a monitoring infrastructure
+                that keeps track of the number of actions raised.  To keep
+                track of the number of actions raised, register an interceptor
+                that runs the counting code before going to any action. A
+                more complex example is an interceptor that might decide
+                to take you to a nested page flow that asks you to fill out a
+                "satisfaction survey" before sending you to the destination
+                page flow.
+            </p>
+            <p>
+                This document describes how to implement and configure
+                action interceptors.
+            </p>
+        </section>
+        <section id="action-interceptors">
+            <title>Action Interceptors</title>
+            <p>
+                To create an action interceptor, extend
+                <a href="apidocs/javadoc/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.html">ActionInterceptor</a>
+                and implement the abstract methods <code>preAction()</code>,
+                <code>postAction()</code>, and <code>afterNestedIntercept()</code>.
+            </p>
+            <p>
+                The action interceptor class is run twice: both before
+                <em>and</em> after the execution of the action.
+                The method <code>preAction()</code> is called before an
+                action is processed. During this callback, the protected
+                method <code>setOverrideForward()</code>
+                may be called to do three things:
+            </p>
+            <ul>
+                <li>
+                    change the destination URI and thus prevent the action
+                    from running, or,
+                </li>
+                <li>
+                    set the destination URI to <code>null</code> (no
+                    forwarding) and thus prevent the action from running, or,
+                </li>
+                <li>
+                    "inject" an entire nested page flow to run before the
+                    action is invoked.  If the override forward URI is a
+                    nested page flow, then it will run until it raises one
+                    of its return actions.  At that point,
+                    <code>afterNestedIntercept()</code> is called on <em>this
+                    interceptor</em>, which can again choose to override
+                    the forward or allow the original action to run.
+                </li>
+            </ul>
+            <p>
+                The method <code>postAction()</code> is called after an
+                action is processed. During this callback, the protected
+                method <code>setOverrideForward()</code>
+                may be called to do two things:
+            </p>
+            <ul>
+                <li>
+                    change the destination URI that was returned by the
+                    action, or,
+                </li>
+                <li>
+                    set the destination URI to <code>null</code> (no forwarding).
+                </li>
+            </ul>
+            <p>
+                Anywhere within the <code>preAction()</code> and
+                <code>postAction()</code> methods,
+                <code>InterceptorChain.continueChain()</code> is called to
+                invoke the rest of the interceptor chain.
+            </p>
+            <p><strong>See:</strong></p>
+            <p>
+                <a href="apidocs/javadoc/org/apache/beehive/netui/pageflow/interceptor/action/ActionInterceptor.html">Class org.apache.beehive.netui.pageflow.interceptor.action.ActionInterceptor</a>
+            </p>
+        </section>
+        <section id="simple-action-interceptors">
+            <title>Simple Action Interceptors</title>
+            <p>
+                There is nothing to implement for a simple action interceptor.
+                Just configure the overriding path or destination URI to
+                forward to and whether it should occur before or after
+                the action.
+            </p>
+        </section>
+        <section id="config-action-interceptors">
+            <title>Configuring Action Interceptors</title>
+            <p>
+                To run code before or after Page Flow actions, you configure a
+                <a href="site:docs/reference/netui/netui_config/config_pageflow_action_interceptor">
+                    &lt;pageflow-action-interceptors&gt;
+                </a> 
+                group in the beehive NetUI configuration file
+                <code>/WEB-INF/beehive-netui-config.xml</code>. For example:
+            </p>
+            <source>
+&lt;netui-config xmlns="http://beehive.apache.org/netui/2004/server/config"&gt;
+    ...
+    &lt;pageflow-action-interceptors&gt;
+        &lt;global&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/simpleintercept/Controller.jpf&lt;/pageflow-uri&gt;
+            &lt;!-- This interceptor is run before any action in the
+                 /example/simpleintercept/Controller.jpf page flow
+                 and forwards to /example/nested/SomeController.jpf --&gt;
+            &lt;simple-action-interceptor&gt;
+                &lt;intercept-path&gt;/example/nested/SomeController.jpf&lt;/intercept-path&gt;
+            &lt;/simple-action-interceptor&gt;
+        &lt;/per-pageflow&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 after the action named
+                     &quot;testSimpleAction&quot; in the /example/intercept/Controller.jpf
+                     page flow. --&gt;
+                &lt;action-name&gt;testSimpleAction&lt;/action-name&gt;
+                &lt;simple-action-interceptor&gt;
+                    &lt;intercept-path&gt;/example/flow/SomeController.jpf&lt;/intercept-path&gt;
+                    &lt;after-action&gt;true&lt;/after-action&gt;
+                &lt;/simple-action-interceptor&gt;
+            &lt;/per-action&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.ActionInterceptor3&lt;/interceptor-class&gt;
+                &lt;/action-interceptor&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;</source>
+        </section>
+    </body>
+    <footer>
+        <legal>
+            Java, J2EE, and JCP are trademarks or registered trademarks of
+            Sun Microsystems, Inc. in the United States and other countries.
+            <br/>
+            &copy; 2004, Apache Software Foundation
+        </legal>
+    </footer>
+</document>

Propchange: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/actionInterceptors.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/samples/index.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/samples/index.xml?view=diff&rev=520421&r1=520420&r2=520421
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/samples/index.xml (original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/netui/samples/index.xml Tue Mar 20 08:13:40 2007
@@ -10,7 +10,11 @@
 			<title>Introduction</title>
 			<p>These samples show individual NetUI features, including:</p>
             <ul>
-                <li>Page Flow Action Interceptors</li>
+                <li>
+                    <a href="site:docs/pageflow/pageflow_advanced/pageflow_action_interceptors">
+                        Page Flow Action Interceptors
+                    </a>
+                </li>
                 <li>
                     <a href="site:docs/pageflow/netuiBasic/exceptionHandling">
                         Exception Handling

Modified: beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml
URL: http://svn.apache.org/viewvc/beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml?view=diff&rev=520421&r1=520420&r2=520421
==============================================================================
--- beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml (original)
+++ beehive/trunk/docs/forrest/release/src/documentation/content/xdocs/site.xml Tue Mar 20 08:13:40 2007
@@ -111,6 +111,7 @@
                 <pageflow_sharedFlowVsInheritance href="netui/sharedFlowVsInheritance.html"/>
                 <pageflow_tiles_support label="Tiles Support" href="netui/tilesSupport.html"/>
                 <pageflow_popups label="Popup Windows" href="netui/popupWindows.html"/>
+                <pageflow_action_interceptors label="Action Interceptors" href="netui/actionInterceptors.html"/>
                 <pageflow_servlet_adapter label="Servlet Container Adapters" href="netui/servletContainerAdapters.html"/>
                 <devmode label="Development Mode" href="netui/devMode.html"/>
             </pageflow_advanced>
@@ -171,6 +172,7 @@
                     <config_description href="#desc"/>
                     <config_id_javascript href="#id-javascript"/>
                     <config_tree_renderer_class href="#tree-renderer-class"/>
+                    <config_pageflow_action_interceptor href="#pageflow-action-interceptors"/>
                 </netui_config>
             </netui>
             <system-controls label="System Controls">