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">
+ <pageflow-action-interceptors>
+ </a>
+ group in the beehive NetUI configuration file
+ <code>/WEB-INF/beehive-netui-config.xml</code>. For example:
+ </p>
+ <source>
+<netui-config xmlns="http://beehive.apache.org/netui/2004/server/config">
+ ...
+ <pageflow-action-interceptors>
+ <global>
+ <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/simpleintercept/Controller.jpf</pageflow-uri>
+ <!-- This interceptor is run before any action in the
+ /example/simpleintercept/Controller.jpf page flow
+ and forwards to /example/nested/SomeController.jpf -->
+ <simple-action-interceptor>
+ <intercept-path>/example/nested/SomeController.jpf</intercept-path>
+ </simple-action-interceptor>
+ </per-pageflow>
+ <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 after the action named
+ "testSimpleAction" in the /example/intercept/Controller.jpf
+ page flow. -->
+ <action-name>testSimpleAction</action-name>
+ <simple-action-interceptor>
+ <intercept-path>/example/flow/SomeController.jpf</intercept-path>
+ <after-action>true</after-action>
+ </simple-action-interceptor>
+ </per-action>
+ <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.ActionInterceptor3</interceptor-class>
+ </action-interceptor>
+ </per-action>
+ ...
+ </per-pageflow>
+ <per-pageflow>
+ ...
+ </per-pageflow>
+ ...
+ </pageflow-action-interceptors>
+ ...
+</netui-config></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/>
+ © 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">