Source Code Cross Referenced for PortletWebContext.java in  » Library » Apache-commons-chain-1.1-src » org » apache » commons » chain » web » portlet » 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 commons chain 1.1 src » org.apache.commons.chain.web.portlet 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 1999-2004 The Apache Software Foundation
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.apache.commons.chain.web.portlet;
017:
018:        import java.util.Collections;
019:        import java.util.Map;
020:        import javax.portlet.PortletContext;
021:        import javax.portlet.PortletRequest;
022:        import javax.portlet.PortletResponse;
023:        import org.apache.commons.chain.web.WebContext;
024:
025:        /**
026:         * <p>Concrete implementation of {@link WebContext} suitable for use in
027:         * portlets.  The abstract methods are mapped to the appropriate
028:         * collections of the underlying portlet context, request, and response
029:         * instances that are passed to the constructor (or the initialize method).</p>
030:         *
031:         * @author Craig R. McClanahan
032:         * @version $Revision: 412789 $ $Date: 2006-06-08 17:19:14 +0100 (Thu, 08 Jun 2006) $
033:         */
034:
035:        public class PortletWebContext extends WebContext {
036:
037:            // ------------------------------------------------------------ Constructors
038:
039:            /**
040:             * <p>Construct an uninitialized {@link PortletWebContext} instance.</p>
041:             */
042:            public PortletWebContext() {
043:            }
044:
045:            /**
046:             * <p>Construct a {@link PortletWebContext} instance that is initialized
047:             * with the specified Portlet API objects.</p>
048:             *
049:             * @param context The <code>PortletContext</code> for this web application
050:             * @param request The <code>PortletRequest</code> for this request
051:             * @param response The <code>PortletResponse</code> for this request
052:             */
053:            public PortletWebContext(PortletContext context,
054:                    PortletRequest request, PortletResponse response) {
055:
056:                initialize(context, request, response);
057:
058:            }
059:
060:            // ------------------------------------------------------ Instance Variables
061:
062:            /**
063:             * <p>The lazily instantiated <code>Map</code> of application scope
064:             * attributes.</p>
065:             */
066:            private Map applicationScope = null;
067:
068:            /**
069:             * <p>The <code>PortletContext</code> for this web application.</p>
070:             */
071:            protected PortletContext context = null;
072:
073:            /**
074:             * <p>The lazily instantiated <code>Map</code> of header name-value
075:             * combinations (immutable).</p>
076:             */
077:            private Map header = null;
078:
079:            /**
080:             * <p>The lazily instantitated <code>Map</code> of header name-values
081:             * combinations (immutable).</p>
082:             */
083:            private Map headerValues = null;
084:
085:            /**
086:             * <p>The lazily instantiated <code>Map</code> of context initialization
087:             * parameters.</p>
088:             */
089:            private Map initParam = null;
090:
091:            /**
092:             * <p>The lazily instantiated <code>Map</code> of request
093:             * parameter name-value.</p>
094:             */
095:            private Map param = null;
096:
097:            /**
098:             * <p>The lazily instantiated <code>Map</code> of request
099:             * parameter name-values.</p>
100:             */
101:            private Map paramValues = null;
102:
103:            /**
104:             * <p>The <code>PortletRequest</code> for this request.</p>
105:             */
106:            protected PortletRequest request = null;
107:
108:            /**
109:             * <p>The lazily instantiated <code>Map</code> of request scope
110:             * attributes.</p>
111:             */
112:            private Map requestScope = null;
113:
114:            /**
115:             * <p>The <code>PortletResponse</code> for this request.</p>
116:             */
117:            protected PortletResponse response = null;
118:
119:            /**
120:             * <p>The lazily instantiated <code>Map</code> of session scope
121:             * attributes.</p>
122:             */
123:            private Map sessionScope = null;
124:
125:            // ---------------------------------------------------------- Public Methods
126:
127:            /**
128:             * <p>Return the {@link PortletContext} for this context.</p>
129:             *
130:             * @return The <code>PortletContext</code> for this request
131:             */
132:            public PortletContext getContext() {
133:
134:                return (this .context);
135:
136:            }
137:
138:            /**
139:             * <p>Return the {@link PortletRequest} for this context.</p>
140:             *
141:             * @return The <code>PortletRequest</code> for this context.
142:             */
143:            public PortletRequest getRequest() {
144:
145:                return (this .request);
146:
147:            }
148:
149:            /**
150:             * <p>Return the {@link PortletResponse} for this context.</p>
151:             *
152:             * @return The <code>PortletResponse</code> for this context.
153:             */
154:            public PortletResponse getResponse() {
155:
156:                return (this .response);
157:
158:            }
159:
160:            /**
161:             * <p>Initialize (or reinitialize) this {@link PortletWebContext} instance
162:             * for the specified Portlet API objects.</p>
163:             *
164:             * @param context The <code>PortletContext</code> for this web application
165:             * @param request The <code>PortletRequest</code> for this request
166:             * @param response The <code>PortletResponse</code> for this request
167:             */
168:            public void initialize(PortletContext context,
169:                    PortletRequest request, PortletResponse response) {
170:
171:                // Save the specified Portlet API object references
172:                this .context = context;
173:                this .request = request;
174:                this .response = response;
175:
176:                // Perform other setup as needed
177:
178:            }
179:
180:            /**
181:             * <p>Release references to allocated resources acquired in
182:             * <code>initialize()</code> of via subsequent processing.  After this
183:             * method is called, subsequent calls to any other method than
184:             * <code>initialize()</code> will return undefined results.</p>
185:             */
186:            public void release() {
187:
188:                // Release references to allocated collections
189:                applicationScope = null;
190:                header = null;
191:                headerValues = null;
192:                initParam = null;
193:                param = null;
194:                paramValues = null;
195:                requestScope = null;
196:                sessionScope = null;
197:
198:                // Release references to Portlet API objects
199:                context = null;
200:                request = null;
201:                response = null;
202:
203:            }
204:
205:            // ------------------------------------------------------ WebContext Methods
206:
207:            /**
208:             * See the {@link WebContext}'s Javadoc.
209:             *
210:             * @return Application scope Map.
211:             */
212:            public Map getApplicationScope() {
213:
214:                if ((applicationScope == null) && (context != null)) {
215:                    applicationScope = new PortletApplicationScopeMap(context);
216:                }
217:                return (applicationScope);
218:
219:            }
220:
221:            /**
222:             * See the {@link WebContext}'s Javadoc.
223:             *
224:             * @return Header values Map.
225:             */
226:            public Map getHeader() {
227:
228:                if ((header == null) && (request != null)) {
229:                    //            header = new PortletHeaderMap(request);
230:                    header = Collections.EMPTY_MAP;
231:                }
232:                return (header);
233:
234:            }
235:
236:            /**
237:             * See the {@link WebContext}'s Javadoc.
238:             *
239:             * @return Header values Map.
240:             */
241:            public Map getHeaderValues() {
242:
243:                if ((headerValues == null) && (request != null)) {
244:                    //            headerValues = new PortletHeaderValuesMap(request);
245:                    headerValues = Collections.EMPTY_MAP;
246:                }
247:                return (headerValues);
248:
249:            }
250:
251:            /**
252:             * See the {@link WebContext}'s Javadoc.
253:             *
254:             * @return Initialization parameter Map.
255:             */
256:            public Map getInitParam() {
257:
258:                if ((initParam == null) && (context != null)) {
259:                    initParam = new PortletInitParamMap(context);
260:                }
261:                return (initParam);
262:
263:            }
264:
265:            /**
266:             * See the {@link WebContext}'s Javadoc.
267:             *
268:             * @return Request parameter Map.
269:             */
270:            public Map getParam() {
271:
272:                if ((param == null) && (request != null)) {
273:                    param = new PortletParamMap(request);
274:                }
275:                return (param);
276:
277:            }
278:
279:            /**
280:             * See the {@link WebContext}'s Javadoc.
281:             *
282:             * @return Request parameter Map.
283:             */
284:            public Map getParamValues() {
285:
286:                if ((paramValues == null) && (request != null)) {
287:                    paramValues = new PortletParamValuesMap(request);
288:                }
289:                return (paramValues);
290:
291:            }
292:
293:            /**
294:             * Returns an empty Map - portlets don't support Cookies.
295:             *
296:             * @return An empty Map.
297:             * @since Chain 1.1
298:             */
299:            public Map getCookies() {
300:
301:                return Collections.EMPTY_MAP;
302:
303:            }
304:
305:            /**
306:             * See the {@link WebContext}'s Javadoc.
307:             *
308:             * @return Request scope Map.
309:             */
310:            public Map getRequestScope() {
311:
312:                if ((requestScope == null) && (request != null)) {
313:                    requestScope = new PortletRequestScopeMap(request);
314:                }
315:                return (requestScope);
316:
317:            }
318:
319:            /**
320:             * See the {@link WebContext}'s Javadoc.
321:             *
322:             * @return Session scope Map.
323:             */
324:            public Map getSessionScope() {
325:
326:                if ((sessionScope == null) && (request != null)) {
327:                    sessionScope = new PortletSessionScopeMap(request);
328:                }
329:                return (sessionScope);
330:
331:            }
332:
333:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.