Source Code Cross Referenced for ActionInterceptor.java in  » Library » Apache-beehive-1.0.2-src » org » apache » beehive » netui » pageflow » interceptor » action » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache beehive 1.0.2 src » org.apache.beehive.netui.pageflow.interceptor.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         *
017:         * $Header:$
018:         */
019:        package org.apache.beehive.netui.pageflow.interceptor.action;
020:
021:        import org.apache.beehive.netui.pageflow.interceptor.AbstractInterceptor;
022:        import org.apache.beehive.netui.pageflow.interceptor.InterceptorChain;
023:        import org.apache.beehive.netui.pageflow.interceptor.InterceptorContext;
024:        import org.apache.beehive.netui.pageflow.interceptor.InterceptorException;
025:
026:        /**
027:         * Base class for Page Flow action interceptors.  These are configured in /WEB-INF/beehive-netui-config.xml like this:
028:         * <pre>
029:         *    &lt;netui-config xmlns="http://beehive.apache.org/netui/2004/server/config"&gt;
030:         *        ...
031:         *    
032:         *        &lt;pageflow-action-interceptors&gt;
033:         *            &lt;global&gt;
034:         *                &lt;before-action&gt;
035:         *                    &lt;action-interceptor&gt;
036:         *                        &lt;interceptor-class&gt;test.BeforeActionInterceptor1&lt;/interceptor-class&gt;
037:         *                    &lt;/action-interceptor&gt;
038:         *                    &lt;action-interceptor&gt;
039:         *                        &lt;interceptor-class&gt;test.BeforeActionInterceptor2&lt;/interceptor-class&gt;
040:         *                    &lt;/action-interceptor&gt;
041:         *                    ...
042:         *                &lt;/before-action&gt;
043:         *                &lt;after-action&gt;
044:         *                    &lt;action-interceptor&gt;
045:         *                        &lt;interceptor-class&gt;test.AfterActionInterceptor1&lt;/interceptor-class&gt;
046:         *                    &lt;/action-interceptor&gt;
047:         *                    &lt;action-interceptor&gt;
048:         *                        &lt;interceptor-class&gt;test.AfterActionInterceptor2&lt;/interceptor-class&gt;
049:         *                    &lt;/action-interceptor&gt;
050:         *                &lt;/after-action&gt;
051:         *            &lt;/global&gt;
052:         *        &lt;/pageflow-action-interceptors&gt;
053:         * 
054:         *        ...
055:         *    &lt;/netui-config&gt;
056:         *
057:         * </pre>
058:         *
059:         * Note that a registered ActionInterceptor is created and cached as a single instance per ServletContext.
060:         * It should not hold any per-request or per-session state.
061:         */
062:        public abstract class ActionInterceptor extends AbstractInterceptor {
063:            /**
064:             * Callback invoked before the action is processed.  During this method, {@link #setOverrideForward} may be called
065:             * to:
066:             * <ul>
067:             *     <li>change the destination URI and thus prevent the action from running, or,</li>
068:             *     <li>set the destination URI to <code>null</code> (no forwarding) and thus prevent the action from running, or,</li>
069:             *     <li>
070:             *         "inject" an entire nested page flow to run before the action is invoked.  If the override forward URI
071:             *         is a nested page flow, then it will run until it raises one of its return actions.  At that point,
072:             *         {@link #afterNestedIntercept} is called on <i>this interceptor</i>, which can again choose to override
073:             *         the forward or allow the original action to run.
074:             *     </li>
075:             * </ul>
076:             * 
077:             * {@link InterceptorChain#continueChain} is called to invoke the rest of the
078:             * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
079:             * 
080:             * @param context the current ActionInterceptorContext.
081:             * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
082:             */
083:            public abstract void preAction(ActionInterceptorContext context,
084:                    InterceptorChain chain) throws InterceptorException;
085:
086:            /**
087:             * Callback invoked before the action is processed.  {@link #preAction} may be used instead.
088:             */
089:            public void preInvoke(InterceptorContext context,
090:                    InterceptorChain chain) throws InterceptorException {
091:                preAction((ActionInterceptorContext) context, chain);
092:            }
093:
094:            /**
095:             * Callback invoked after the action is processed.  During this method, {@link #setOverrideForward} may be called
096:             * to:
097:             * <ul>
098:             *     <li>change the destination URI and thus override the one returned from the action, or,</li>
099:             *     <li>set the destination URI to <code>null</code> (no forwarding).</li>
100:             * </ul>
101:             * 
102:             * {@link InterceptorChain#continueChain} is called to invoke the rest of the
103:             * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
104:             * 
105:             * @param context the current ActionInterceptorContext.
106:             * @param chain the interceptor chain. Calling <code>continueChain</code> on this runs the rest of the interceptors.
107:             */
108:            public abstract void postAction(ActionInterceptorContext context,
109:                    InterceptorChain chain) throws InterceptorException;
110:
111:            /**
112:             * Callback invoked after the action is processed.  {@link #postAction} may be used instead.
113:             */
114:            public void postInvoke(InterceptorContext context,
115:                    InterceptorChain chain) throws InterceptorException {
116:                postAction((ActionInterceptorContext) context, chain);
117:            }
118:
119:            /**
120:             * Callback invoked after a nested page flow has been "injected" by {@link #preAction}, and before the original
121:             * action has run.  During this method, {@link #setOverrideForward} may be called to:
122:             * 
123:             * <ul>
124:             *     <li>change the destination URI that was returned by the action, or,</li>
125:             *     <li>set the destination URI to <code>null</code> (no forwarding).</li>
126:             * </ul>
127:             * 
128:             * {@link InterceptorChain#continueChain} is called to invoke the rest of the
129:             * interceptor chain, anywhere within this method (e.g., at the end, or within a try/finally).
130:             * 
131:             * @param context an extension of {@link ActionInterceptorContext} which contains the return action from the
132:             *            injected nested page flow.
133:             * @throws InterceptorException
134:             */
135:            public abstract void afterNestedIntercept(
136:                    AfterNestedInterceptContext context)
137:                    throws InterceptorException;
138:
139:            /**
140:             * Override the Forward, either before or after the target action is run.  See {@link #preAction} and
141:             * {@link #postAction} for information on how this is used.
142:             * 
143:             * @param forward an InterceptorForward that will override the target action's forward; or <code>null</code> to
144:             *            cancel navigation.
145:             * @param context the current ActionInterceptorContext.
146:             */
147:            protected void setOverrideForward(InterceptorForward forward,
148:                    ActionInterceptorContext context) {
149:                context.setOverrideForward(forward, this );
150:            }
151:
152:            /**
153:             * Optional method that "wraps" the target action invocation.  This is mainly useful for surrounding an action
154:             * (and the rest of the interceptor chain) with try/catch/finally.  This default implementation simply <i>returns</i>
155:             * <code>continueChain</code> on the passed-in InterceptorChain, which allows the rest of the interceptors
156:             * <i>and</i> the action to run.
157:             * 
158:             * @param context the current ActionInterceptorContext.
159:             * @param chain the interceptor chain.  This chain is different from the ones passed to {@link #preAction} and
160:             *            {@link #postAction} in that the action invocation itself is included in it.
161:             * @return the ActionForward returned by the action.
162:             */
163:            public Object wrapAction(ActionInterceptorContext context,
164:                    InterceptorChain chain) throws InterceptorException {
165:                return chain.continueChain();
166:            }
167:        }
w__ww___.j__a_va_2_s__.__co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.