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


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.webwork.util;
006:
007:        import com.opensymphony.xwork.ActionContext;
008:        import com.opensymphony.xwork.ActionInvocation;
009:        import com.opensymphony.xwork.util.OgnlValueStack;
010:
011:        import java.io.Serializable;
012:        import java.util.HashMap;
013:        import java.util.Map;
014:
015:        /**
016:         * InvocationSessionStore
017:         *
018:         * @author Jason Carreira
019:         *         Created Apr 12, 2003 9:53:19 PM
020:         */
021:        public class InvocationSessionStore {
022:
023:            private static final String INVOCATION_MAP_KEY = "com.opensymphony.webwork.util.InvocationSessionStore.invocationMap";
024:
025:            private InvocationSessionStore() {
026:            }
027:
028:            /**
029:             * Checks the Map in the Session for the key and the token. If the
030:             * ActionInvocation is saved in the Session, the ValueStack from the
031:             * ActionProxy associated with the ActionInvocation is set into the
032:             * ActionContext and the ActionInvocation is returned.
033:             *
034:             * @param key the name the DefaultActionInvocation and ActionContext were saved as
035:             * @return the DefaultActionInvocation saved using the key, or null if none was found
036:             */
037:            public static ActionInvocation loadInvocation(String key,
038:                    String token) {
039:                InvocationContext invocationContext = (InvocationContext) getInvocationMap()
040:                        .get(key);
041:
042:                if ((invocationContext == null)
043:                        || !invocationContext.token.equals(token)) {
044:                    return null;
045:                }
046:
047:                OgnlValueStack stack = invocationContext.invocation.getStack();
048:                ActionContext.getContext().setValueStack(stack);
049:
050:                return invocationContext.invocation;
051:            }
052:
053:            /**
054:             * Stores the DefaultActionInvocation and ActionContext into the Session using the provided key for loading later using
055:             * {@link #loadInvocation}
056:             *
057:             * @param key
058:             * @param invocation
059:             */
060:            public static void storeInvocation(String key, String token,
061:                    ActionInvocation invocation) {
062:                InvocationContext invocationContext = new InvocationContext(
063:                        invocation, token);
064:                Map invocationMap = getInvocationMap();
065:                invocationMap.put(key, invocationContext);
066:                setInvocationMap(invocationMap);
067:            }
068:
069:            static void setInvocationMap(Map invocationMap) {
070:                Map session = ActionContext.getContext().getSession();
071:
072:                if (session == null) {
073:                    throw new IllegalStateException(
074:                            "Unable to access the session.");
075:                }
076:
077:                session.put(INVOCATION_MAP_KEY, invocationMap);
078:            }
079:
080:            static Map getInvocationMap() {
081:                Map session = ActionContext.getContext().getSession();
082:
083:                if (session == null) {
084:                    throw new IllegalStateException(
085:                            "Unable to access the session.");
086:                }
087:
088:                Map invocationMap = (Map) session.get(INVOCATION_MAP_KEY);
089:
090:                if (invocationMap == null) {
091:                    invocationMap = new HashMap();
092:                    setInvocationMap(invocationMap);
093:                }
094:
095:                return invocationMap;
096:            }
097:
098:            private static class InvocationContext implements  Serializable {
099:                ActionInvocation invocation;
100:                String token;
101:
102:                public InvocationContext(ActionInvocation invocation,
103:                        String token) {
104:                    this.invocation = invocation;
105:                    this.token = token;
106:                }
107:            }
108:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.