Source Code Cross Referenced for ActionContext.java in  » J2EE » jfox » com » ibatis » struts » 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 » jfox » com.ibatis.struts 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibatis.struts;
002:
003:        import java.util.ArrayList;
004:        import java.util.List;
005:        import java.util.Map;
006:
007:        import javax.servlet.http.HttpServletRequest;
008:        import javax.servlet.http.HttpServletResponse;
009:
010:        import com.ibatis.struts.httpmap.ApplicationMap;
011:        import com.ibatis.struts.httpmap.CookieMap;
012:        import com.ibatis.struts.httpmap.ParameterMap;
013:        import com.ibatis.struts.httpmap.RequestMap;
014:        import com.ibatis.struts.httpmap.SessionMap;
015:
016:        /**
017:         * The ActionContext class gives simplified, thread-safe access to the request
018:         * and response, as well as form parameters, request attributes, session
019:         * attributes, application attributes. Much of this can be accopmplished without
020:         * using the Struts or even the Servlet API, therefore isolating your
021:         * application from presentation framework details. <p/>This class also
022:         * provides facilities for simpler message and error message handling. Although
023:         * not as powerful as that provided by Struts, it is great for simple
024:         * applications that don't require internationalization or the flexibility of
025:         * resource bundles. <p/><i>Note: A more complete error and message handling
026:         * API will be implemented. </i> <p/>Date: Mar 9, 2004 9:57:39 PM
027:         * 
028:         * @author Clinton Begin
029:         */
030:        public class ActionContext {
031:
032:            private static final ThreadLocal localContext = new ThreadLocal();
033:
034:            private HttpServletRequest request;
035:
036:            private HttpServletResponse response;
037:
038:            private Map cookieMap;
039:
040:            private Map parameterMap;
041:
042:            private Map requestMap;
043:
044:            private Map sessionMap;
045:
046:            private Map applicationMap;
047:
048:            private ActionContext() {
049:            }
050:
051:            protected static void initialize(HttpServletRequest request,
052:                    HttpServletResponse response) {
053:                ActionContext ctx = getActionContext();
054:                ctx.request = request;
055:                ctx.response = response;
056:                ctx.cookieMap = null;
057:                ctx.parameterMap = null;
058:                ctx.requestMap = null;
059:                ctx.sessionMap = null;
060:                ctx.applicationMap = null;
061:            }
062:
063:            public void setSimpleMessage(String message) {
064:                getRequestMap().put("message", message);
065:            }
066:
067:            public void addSimpleError(String message) {
068:                List errors = (List) getRequestMap().get("errors");
069:                if (errors == null) {
070:                    errors = new ArrayList();
071:                    getRequestMap().put("errors", errors);
072:                }
073:                errors.add(message);
074:            }
075:
076:            public boolean isSimpleErrorsExist() {
077:                List errors = (List) getRequestMap().get("errors");
078:                return errors != null && errors.size() > 0;
079:            }
080:
081:            public Map getCookieMap() {
082:                if (cookieMap == null) {
083:                    cookieMap = new CookieMap(request);
084:                }
085:                return cookieMap;
086:            }
087:
088:            public Map getParameterMap() {
089:                if (parameterMap == null) {
090:                    parameterMap = new ParameterMap(request);
091:                }
092:                return parameterMap;
093:            }
094:
095:            public Map getRequestMap() {
096:                if (requestMap == null) {
097:                    requestMap = new RequestMap(request);
098:                }
099:                return requestMap;
100:            }
101:
102:            public Map getSessionMap() {
103:                if (sessionMap == null) {
104:                    sessionMap = new SessionMap(request);
105:                }
106:                return sessionMap;
107:            }
108:
109:            public Map getApplicationMap() {
110:                if (applicationMap == null) {
111:                    applicationMap = new ApplicationMap(request);
112:                }
113:                return applicationMap;
114:            }
115:
116:            public HttpServletRequest getRequest() {
117:                return request;
118:            }
119:
120:            public HttpServletResponse getResponse() {
121:                return response;
122:            }
123:
124:            public static ActionContext getActionContext() {
125:                ActionContext ctx = (ActionContext) localContext.get();
126:                if (ctx == null) {
127:                    ctx = new ActionContext();
128:                    localContext.set(ctx);
129:                }
130:                return ctx;
131:            }
132:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.