Source Code Cross Referenced for SessionContextAutowiringInterceptor.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » spring » interceptor » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.spring.interceptor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        /*
02:         * Copyright (c) 2005 ePlus Corporation. All Rights Reserved.
03:         */
04:        package com.opensymphony.webwork.spring.interceptor;
05:
06:        import com.opensymphony.xwork.interceptor.AroundInterceptor;
07:        import com.opensymphony.xwork.ActionInvocation;
08:        import com.opensymphony.webwork.spring.lifecycle.ApplicationContextSessionListener;
09:        import org.springframework.context.ApplicationContext;
10:        import org.springframework.context.ConfigurableApplicationContext;
11:        import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
12:
13:        import java.util.Map;
14:
15:        /**
16:         * <!-- START SNIPPET: description -->
17:         * TODO: Give a description of the Interceptor.
18:         * <!-- END SNIPPET: description -->
19:         *
20:         * <!-- START SNIPPET: parameters -->
21:         * TODO: Describe the paramters for this Interceptor.
22:         * <!-- END SNIPPET: parameters -->
23:         *
24:         * <!-- START SNIPPET: extending -->
25:         * TODO: Discuss some possible extension of the Interceptor.
26:         * <!-- END SNIPPET: extending -->
27:         *
28:         * <pre>
29:         * <!-- START SNIPPET: example -->
30:         * &lt;!-- TODO: Describe how the Interceptor reference will effect execution --&gt;
31:         * &lt;action name="someAction" class="com.examples.SomeAction"&gt;
32:         *      TODO: fill in the interceptor reference.
33:         *     &lt;interceptor-ref name=""/&gt;
34:         *     &lt;result name="success"&gt;good_result.ftl&lt;/result&gt;
35:         * &lt;/action&gt;
36:         * <!-- END SNIPPET: example -->
37:         * </pre>
38:         * 
39:         * SessionContextAutowiringInterceptor
40:         * Created : Aug 21, 2005 12:34:20 AM
41:         *
42:         * @author Jason Carreira <jcarreira@eplus.com>
43:         */
44:        public class SessionContextAutowiringInterceptor extends
45:                AroundInterceptor {
46:            private Integer autowireStrategy = new Integer(
47:                    AutowireCapableBeanFactory.AUTOWIRE_BY_NAME);
48:
49:            public void setAutowireStrategy(Integer autowireStrategy) {
50:                this .autowireStrategy = autowireStrategy;
51:            }
52:
53:            protected void after(ActionInvocation dispatcher, String result)
54:                    throws Exception {
55:            }
56:
57:            protected void before(ActionInvocation invocation) throws Exception {
58:                Map session = invocation.getInvocationContext().getSession();
59:                ApplicationContext applicationContext = (ApplicationContext) session
60:                        .get(ApplicationContextSessionListener.APP_CONTEXT_SESSION_KEY);
61:                AutowireCapableBeanFactory factory = findAutoWiringBeanFactory(applicationContext);
62:                factory.autowireBeanProperties(invocation.getAction(),
63:                        autowireStrategy.intValue(), false);
64:            }
65:
66:            protected AutowireCapableBeanFactory findAutoWiringBeanFactory(
67:                    ApplicationContext context) {
68:                if (context instanceof  AutowireCapableBeanFactory) {
69:                    // Check the context
70:                    return (AutowireCapableBeanFactory) context;
71:                } else if (context instanceof  ConfigurableApplicationContext) {
72:                    // Try and grab the beanFactory
73:                    return ((ConfigurableApplicationContext) context)
74:                            .getBeanFactory();
75:                } else if (context.getParent() != null) {
76:                    // And if all else fails, try again with the parent context
77:                    return findAutoWiringBeanFactory(context.getParent());
78:                }
79:                return null;
80:            }
81:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.