Source Code Cross Referenced for HttpServletResponseStringbeansWrapper.java in  » Portal » stringbeans-3.5 » com » nabhinc » portal » container » 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 » Portal » stringbeans 3.5 » com.nabhinc.portal.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * (C) Copyright 2000 - 2003 Nabh Information Systems, Inc. 
003:         * 
004:         * This program is free software; you can redistribute it and/or
005:         * modify it under the terms of the GNU General Public License 
006:         * as published by the Free Software Foundation; either version 2
007:         * of the License, or (at your option) any later version.
008:         * 
009:         * This program is distributed in the hope that it will be useful,
010:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
011:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
012:         * GNU General Public License for more details.
013:         * 
014:         * You should have received a copy of the GNU General Public License
015:         * along with this program; if not, write to the Free Software 
016:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
017:         * 
018:         */
019:
020:        package com.nabhinc.portal.container;
021:
022:        import java.io.IOException;
023:        import java.io.PrintWriter;
024:        import java.util.Locale;
025:
026:        import javax.servlet.ServletOutputStream;
027:        import javax.servlet.http.Cookie;
028:        import javax.servlet.http.HttpServletResponse;
029:        import javax.servlet.http.HttpServletResponseWrapper;
030:
031:        /**
032:         * Response wrapper implementation that allows Stringbeans to work
033:         * within Weblogic, or for that matter any app server that checks for the
034:         * original response object supplied to PortalServlet during invocation of
035:         * an included JSP or servlet.
036:         *
037:         * @author Padmanabh dabke
038:         * (c) 2003 Nabh Information Systems, Inc. All Rights Reserved.
039:         */
040:        public class HttpServletResponseStringbeansWrapper extends
041:                HttpServletResponseWrapper implements  HttpServletResponse {
042:            private PrintWriter hsriWriter = null;
043:            private HttpServletResponse hsriOriginalResponse = null;
044:
045:            private RenderResponseImpl hsriRenderResponse = null;
046:
047:            private ServletOutputStream hsriServletOutputStream = null;
048:
049:            /**
050:             * @param path
051:             * @return
052:             */
053:            public String encodeURL(String path) {
054:                //if (hsriRenderResponse == null)
055:                return hsriOriginalResponse.encodeURL(path);
056:                //else
057:                //	return hsriRenderResponse.encodeURL(path);
058:            }
059:
060:            /**
061:             * @param path
062:             * @return
063:             */
064:            public String encodeUrl(String path) {
065:                //if (hsriRenderResponse == null)
066:                return hsriOriginalResponse.encodeUrl(path);
067:                //else
068:                //return hsriRenderResponse.encodeURL(path);
069:            }
070:
071:            /**
072:             * @throws java.io.IOException
073:             */
074:            public void flushBuffer() throws IOException {
075:                if (hsriRenderResponse == null)
076:                    hsriOriginalResponse.flushBuffer();
077:                else
078:                    hsriRenderResponse.flushBuffer();
079:            }
080:
081:            /**
082:             * @return
083:             */
084:            public int getBufferSize() {
085:                if (hsriRenderResponse == null)
086:                    return hsriOriginalResponse.getBufferSize();
087:                else
088:                    return hsriRenderResponse.getBufferSize();
089:            }
090:
091:            /**
092:             * @return
093:             */
094:            public String getCharacterEncoding() {
095:
096:                return hsriOriginalResponse.getCharacterEncoding();
097:                /*
098:                if (hsriRenderResponse == null)
099:                	return hsriOriginalResponse.getCharacterEncoding();
100:                else
101:                	return hsriRenderResponse.getCharacterEncoding();
102:                 */
103:            }
104:
105:            /**
106:             * @return
107:             * @throws java.io.IOException
108:             */
109:            public PrintWriter getWriter() throws IOException {
110:                if (hsriRenderResponse == null) {
111:                    if (hsriWriter == null)
112:                        hsriWriter = hsriOriginalResponse.getWriter();
113:                    return hsriWriter;
114:                } else {
115:                    return hsriRenderResponse.getWriter();
116:
117:                }
118:
119:            }
120:
121:            /**
122:             * @return
123:             */
124:            public boolean isCommitted() {
125:                if (hsriRenderResponse == null)
126:                    return hsriOriginalResponse.isCommitted();
127:                else
128:                    return hsriRenderResponse.isCommitted();
129:            }
130:
131:            /**
132:             * 
133:             */
134:            public void reset() {
135:                if (hsriRenderResponse == null)
136:                    hsriOriginalResponse.reset();
137:                else
138:                    hsriRenderResponse.reset();
139:            }
140:
141:            /**
142:             * 
143:             */
144:            public void resetBuffer() {
145:                if (hsriRenderResponse == null)
146:                    hsriOriginalResponse.resetBuffer();
147:                else
148:                    hsriRenderResponse.resetBuffer();
149:            }
150:
151:            /**
152:             * @param size
153:             */
154:            public void setBufferSize(int size) {
155:                if (hsriRenderResponse == null)
156:                    // Commenting the next line out since it causes a problem in Weblogic
157:                    //hsriOriginalResponse.setBufferSize(size);
158:                    ;
159:                else
160:                    hsriRenderResponse.setBufferSize(size);
161:            }
162:
163:            public HttpServletResponseStringbeansWrapper(RenderResponseImpl resp) {
164:                super (resp.getHttpServletResponse());
165:                hsriRenderResponse = resp;
166:                hsriOriginalResponse = resp.getHttpServletResponse();
167:            }
168:
169:            public HttpServletResponseStringbeansWrapper(
170:                    RenderResponseImpl resp, HttpServletResponse origResp) {
171:                super (origResp);
172:                hsriRenderResponse = resp;
173:                hsriOriginalResponse = resp.getHttpServletResponse();
174:            }
175:
176:            public HttpServletResponseStringbeansWrapper(
177:                    HttpServletResponse resp) {
178:                super (resp);
179:                hsriOriginalResponse = resp;
180:            }
181:
182:            public void setRenderResponse(RenderResponseImpl resp) {
183:                hsriRenderResponse = resp;
184:                hsriServletOutputStream = null;
185:            }
186:
187:            /* (non-Javadoc)
188:             * @see javax.servlet.http.HttpServletResponse#addCookie(javax.servlet.http.Cookie)
189:             */
190:            public void addCookie(Cookie arg0) {
191:                if (hsriRenderResponse == null)
192:                    hsriOriginalResponse.addCookie(arg0);
193:
194:            }
195:
196:            /* (non-Javadoc)
197:             * @see javax.servlet.http.HttpServletResponse#containsHeader(java.lang.String)
198:             */
199:            public boolean containsHeader(String arg0) {
200:                if (hsriRenderResponse == null)
201:                    return hsriOriginalResponse.containsHeader(arg0);
202:                else
203:                    return false;
204:            }
205:
206:            /* (non-Javadoc)
207:             * @see javax.servlet.http.HttpServletResponse#encodeRedirectURL(java.lang.String)
208:             */
209:            public String encodeRedirectURL(String arg0) {
210:                if (hsriRenderResponse == null)
211:                    return hsriOriginalResponse.encodeRedirectURL(arg0);
212:                else
213:                    return null;
214:            }
215:
216:            /* (non-Javadoc)
217:             * @see javax.servlet.http.HttpServletResponse#encodeRedirectUrl(java.lang.String)
218:             */
219:            public String encodeRedirectUrl(String arg0) {
220:                if (hsriRenderResponse == null)
221:                    return hsriOriginalResponse.encodeRedirectUrl(arg0);
222:                else
223:                    return null;
224:            }
225:
226:            /* (non-Javadoc)
227:             * @see javax.servlet.http.HttpServletResponse#sendError(int, java.lang.String)
228:             */
229:            public void sendError(int arg0, String arg1) throws IOException {
230:                if (hsriRenderResponse == null)
231:                    hsriOriginalResponse.sendError(arg0, arg1);
232:
233:            }
234:
235:            /* (non-Javadoc)
236:             * @see javax.servlet.http.HttpServletResponse#sendError(int)
237:             */
238:            public void sendError(int arg0) throws IOException {
239:                if (hsriRenderResponse == null)
240:                    hsriOriginalResponse.sendError(arg0);
241:            }
242:
243:            /* (non-Javadoc)
244:             * @see javax.servlet.http.HttpServletResponse#sendRedirect(java.lang.String)
245:             */
246:            public void sendRedirect(String arg0) throws IOException {
247:                if (hsriRenderResponse == null)
248:                    hsriOriginalResponse.sendRedirect(arg0);
249:
250:            }
251:
252:            /* (non-Javadoc)
253:             * @see javax.servlet.http.HttpServletResponse#setDateHeader(java.lang.String, long)
254:             */
255:            public void setDateHeader(String arg0, long arg1) {
256:                if (hsriRenderResponse == null)
257:                    hsriOriginalResponse.setDateHeader(arg0, arg1);
258:
259:            }
260:
261:            /* (non-Javadoc)
262:             * @see javax.servlet.http.HttpServletResponse#addDateHeader(java.lang.String, long)
263:             */
264:            public void addDateHeader(String arg0, long arg1) {
265:                if (hsriRenderResponse == null)
266:                    hsriOriginalResponse.addDateHeader(arg0, arg1);
267:
268:            }
269:
270:            /* (non-Javadoc)
271:             * @see javax.servlet.http.HttpServletResponse#setHeader(java.lang.String, java.lang.String)
272:             */
273:            public void setHeader(String arg0, String arg1) {
274:                if (hsriRenderResponse == null)
275:                    hsriOriginalResponse.setHeader(arg0, arg1);
276:
277:            }
278:
279:            /* (non-Javadoc)
280:             * @see javax.servlet.http.HttpServletResponse#addHeader(java.lang.String, java.lang.String)
281:             */
282:            public void addHeader(String arg0, String arg1) {
283:                if (hsriRenderResponse == null)
284:                    hsriOriginalResponse.addHeader(arg0, arg1);
285:
286:            }
287:
288:            /* (non-Javadoc)
289:             * @see javax.servlet.http.HttpServletResponse#setIntHeader(java.lang.String, int)
290:             */
291:            public void setIntHeader(String arg0, int arg1) {
292:                if (hsriRenderResponse == null)
293:                    hsriOriginalResponse.setIntHeader(arg0, arg1);
294:
295:            }
296:
297:            /* (non-Javadoc)
298:             * @see javax.servlet.http.HttpServletResponse#addIntHeader(java.lang.String, int)
299:             */
300:            public void addIntHeader(String arg0, int arg1) {
301:                if (hsriRenderResponse == null)
302:                    hsriOriginalResponse.addIntHeader(arg0, arg1);
303:
304:            }
305:
306:            /* (non-Javadoc)
307:             * @see javax.servlet.http.HttpServletResponse#setStatus(int)
308:             */
309:            public void setStatus(int arg0) {
310:                if (hsriRenderResponse == null)
311:                    hsriOriginalResponse.setStatus(arg0);
312:
313:            }
314:
315:            /* (non-Javadoc)
316:             * @see javax.servlet.http.HttpServletResponse#setStatus(int, java.lang.String)
317:             */
318:            public void setStatus(int arg0, String arg1) {
319:                if (hsriRenderResponse == null)
320:                    hsriOriginalResponse.setStatus(arg0, arg1);
321:
322:            }
323:
324:            /* (non-Javadoc)
325:             * @see javax.servlet.ServletResponse#getOutputStream()
326:             */
327:            public ServletOutputStream getOutputStream() throws IOException {
328:                if (hsriRenderResponse == null)
329:                    return hsriOriginalResponse.getOutputStream();
330:
331:                if (hsriServletOutputStream == null) {
332:                    hsriServletOutputStream = new ServletOutputStreamImpl(
333:                            hsriRenderResponse);
334:                }
335:                return hsriServletOutputStream;
336:            }
337:
338:            /* (non-Javadoc)
339:             * @see javax.servlet.ServletResponse#setContentLength(int)
340:             */
341:            public void setContentLength(int arg0) {
342:                if (hsriRenderResponse == null)
343:                    hsriOriginalResponse.setContentLength(arg0);
344:            }
345:
346:            /* (non-Javadoc)
347:             * @see javax.servlet.ServletResponse#setContentType(java.lang.String)
348:             */
349:            public void setContentType(String arg0) {
350:                if (hsriRenderResponse == null)
351:                    hsriOriginalResponse.setContentType(arg0);
352:            }
353:
354:            /* (non-Javadoc)
355:             * @see javax.servlet.ServletResponse#setLocale(java.util.Locale)
356:             */
357:            public void setLocale(Locale arg0) {
358:                if (hsriRenderResponse == null)
359:                    hsriOriginalResponse.setLocale(arg0);
360:
361:            }
362:
363:            /* (non-Javadoc)
364:             * @see javax.servlet.ServletResponse#getLocale()
365:             */
366:            public Locale getLocale() {
367:                //if (hsriRenderResponse == null)
368:                return hsriOriginalResponse.getLocale();
369:                //else
370:                //return hsriRenderResponse.getLocale();
371:            }
372:
373:            /* (non-Javadoc)
374:             * @see javax.servlet.ServletResponse#getContentType()
375:             */
376:            public String getContentType() {
377:                // Added to comply to Servlet 2.4 specification
378:                if (hsriRenderResponse == null)
379:                    // return hsriOriginalResponse.getContentType();
380:                    return null;
381:                else
382:                    return hsriRenderResponse.getContentType();
383:            }
384:
385:            /* (non-Javadoc)
386:             * @see javax.servlet.ServletResponse#setCharacterEncoding(java.lang.String)
387:             */
388:            public void setCharacterEncoding(String arg0) {
389:                // Added to comply to Servlet 2.4 specification
390:                //if (hsriRenderResponse == null)
391:                //	hsriOriginalResponse.setCharacterEncoding(arg0);
392:
393:            }
394:
395:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.