Source Code Cross Referenced for JsfExternalContext.java in  » Workflow-Engines » spring-webflow-1.0.4 » org » springframework » webflow » executor » jsf » 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 » Workflow Engines » spring webflow 1.0.4 » org.springframework.webflow.executor.jsf 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2004-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package org.springframework.webflow.executor.jsf;
017:
018:        import javax.faces.context.FacesContext;
019:
020:        import org.springframework.binding.collection.SharedMapDecorator;
021:        import org.springframework.core.style.ToStringCreator;
022:        import org.springframework.webflow.context.ExternalContext;
023:        import org.springframework.webflow.core.collection.LocalAttributeMap;
024:        import org.springframework.webflow.core.collection.LocalParameterMap;
025:        import org.springframework.webflow.core.collection.LocalSharedAttributeMap;
026:        import org.springframework.webflow.core.collection.MutableAttributeMap;
027:        import org.springframework.webflow.core.collection.ParameterMap;
028:        import org.springframework.webflow.core.collection.SharedAttributeMap;
029:
030:        /**
031:         * Provides contextual information about a JSF environment that has interacted with SWF.
032:         * 
033:         * @author Keith Donald
034:         */
035:        public class JsfExternalContext implements  ExternalContext {
036:
037:            /**
038:             * The JSF Faces context.
039:             */
040:            private FacesContext facesContext;
041:
042:            /**
043:             * The id of the action or "command button" that fired.
044:             */
045:            private String actionId;
046:
047:            /**
048:             * The action outcome.
049:             */
050:            private String outcome;
051:
052:            /**
053:             * An accessor for the JSF request parameter map.
054:             */
055:            private ParameterMap requestParameterMap;
056:
057:            /**
058:             * An accessor for the JSF request attribute map.
059:             */
060:            private MutableAttributeMap requestMap;
061:
062:            /**
063:             * An accessor for the JSF session map.
064:             */
065:            private SharedAttributeMap sessionMap;
066:
067:            /**
068:             * An accessor for the JSF application map.
069:             */
070:            private SharedAttributeMap applicationMap;
071:
072:            /**
073:             * Creates a JSF External Context.
074:             * @param facesContext the JSF faces context
075:             */
076:            public JsfExternalContext(FacesContext facesContext) {
077:                this .facesContext = facesContext;
078:                initMaps(facesContext);
079:            }
080:
081:            /**
082:             * Initializes parameter and attribute maps from context data structures.
083:             * @param facesContext the faces context
084:             */
085:            private void initMaps(FacesContext facesContext) {
086:                this .requestParameterMap = new LocalParameterMap(facesContext
087:                        .getExternalContext().getRequestParameterMap());
088:                this .requestMap = new LocalAttributeMap(facesContext
089:                        .getExternalContext().getRequestMap());
090:                this .sessionMap = new LocalSharedAttributeMap(
091:                        new SessionSharedMap(facesContext));
092:                this .applicationMap = new LocalSharedAttributeMap(
093:                        new ApplicationSharedMap(facesContext));
094:            }
095:
096:            public String getContextPath() {
097:                return facesContext.getExternalContext()
098:                        .getRequestContextPath();
099:            }
100:
101:            public String getDispatcherPath() {
102:                return facesContext.getExternalContext()
103:                        .getRequestServletPath();
104:            }
105:
106:            public String getRequestPathInfo() {
107:                return facesContext.getExternalContext().getRequestPathInfo();
108:            }
109:
110:            public ParameterMap getRequestParameterMap() {
111:                return requestParameterMap;
112:            }
113:
114:            public MutableAttributeMap getRequestMap() {
115:                return requestMap;
116:            }
117:
118:            public SharedAttributeMap getSessionMap() {
119:                return sessionMap;
120:            }
121:
122:            public SharedAttributeMap getGlobalSessionMap() {
123:                return getSessionMap();
124:            }
125:
126:            public SharedAttributeMap getApplicationMap() {
127:                return applicationMap;
128:            }
129:
130:            /**
131:             * Returns the JSF FacesContext.
132:             */
133:            public FacesContext getFacesContext() {
134:                return facesContext;
135:            }
136:
137:            /**
138:             * Returns the action identifier.
139:             */
140:            public String getActionId() {
141:                return actionId;
142:            }
143:
144:            /**
145:             * Returns the action outcome.
146:             */
147:            public String getOutcome() {
148:                return outcome;
149:            }
150:
151:            /**
152:             * Records the action and outcome context information when navigation handling occurs.
153:             * @param actionId the from action identifier
154:             * @param outcome the action outcome
155:             */
156:            public void handleNavigationCalled(String actionId, String outcome) {
157:                this .actionId = actionId;
158:                this .outcome = outcome;
159:            }
160:
161:            /**
162:             * An accessor of a JSF session map.
163:             * @author Keith Donald
164:             */
165:            private static class SessionSharedMap extends SharedMapDecorator {
166:
167:                private FacesContext facesContext;
168:
169:                public SessionSharedMap(FacesContext facesContext) {
170:                    super (facesContext.getExternalContext().getSessionMap());
171:                    this .facesContext = facesContext;
172:                }
173:
174:                public Object getMutex() {
175:                    return facesContext.getExternalContext().getSession(false);
176:                }
177:            }
178:
179:            /**
180:             * An accessor of an JSF application map.
181:             * @author Keith Donald
182:             */
183:            private static class ApplicationSharedMap extends
184:                    SharedMapDecorator {
185:
186:                private FacesContext facesContext;
187:
188:                public ApplicationSharedMap(FacesContext facesContext) {
189:                    super (facesContext.getExternalContext().getApplicationMap());
190:                    this .facesContext = facesContext;
191:                }
192:
193:                public Object getMutex() {
194:                    return facesContext.getExternalContext().getContext();
195:                }
196:            }
197:
198:            public String toString() {
199:                return new ToStringCreator(this ).append("actionId", actionId)
200:                        .append("outcome", outcome).append("facesContext",
201:                                facesContext).toString();
202:            }
203:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.